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: LastRenshai <las...@us...> - 2005-08-16 12:34:35
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv465/lang/en Modified Files: stack.php Log Message: Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/stack.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** stack.php 31 Jul 2005 07:42:28 -0000 1.17 --- stack.php 16 Aug 2005 12:34:14 -0000 1.18 *************** *** 354,357 **** --- 354,364 ---- $string['ATPartFrac_ret_expression'] ='Your answer as a single fraction is {$a[0]}. '; + $string['ATSingFrac_error_list'] = $string['ATFacForm_error_list']; + $string['ATSingFrac_true'] = ''; + $string['ATSingFrac_part'] = 'Your answer needs to be in Single Fraction of the form a/b. '; + $string['ATSingFrac_var'] = 'The variables in your answer are different to the those of the question, please check them. '; + $string['ATSingFrac_ret_Q'] = 'It appears that you have simplified ($a[0]}. '; + $string['ATSingFrac_ret_exp'] = 'Your answer {$a[0]} is not algebraically equivalent to the answer. You must have done something wrong. '; + $string['ATInt_error_list'] = $string['ATFacForm_error_list']; $string['ATInt_const_int'] = 'You need to add a constant of integration. This should be an arbitrary constant, not a number.'; |
From: LastRenshai <las...@us...> - 2005-08-16 12:34:34
|
Update of /cvsroot/stack/stack-1-0/lang/en/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv465/lang/en/doc Modified Files: author_testsuite.php Log Message: Index: author_testsuite.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/doc/author_testsuite.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** author_testsuite.php 25 Jul 2005 10:09:32 -0000 1.6 --- author_testsuite.php 16 Aug 2005 12:34:14 -0000 1.7 *************** *** 150,156 **** $testsuite[] = stack_testsuite_construct('PartFrac','1/n','1/n',0,'n',''); $testsuite[] = stack_testsuite_construct('PartFrac','1/(n+1)-1/n','1/(n+1)-1/n',1,'n','A simple correct answer'); ! $testsuite[] = stack_testsuite_construct('PartFrac','3/(x+1) + 3/(x+2)','3*(2*x+3)/((x+1)*(x+2))',1,'x','Correct Answer, unfactored'); ! $testsuite[] = stack_testsuite_construct('PartFrac','3*(1/(x+1) + 1/(x+2))','3*(2*x+3)/((x+1)*(x+2))',1,'x','Correct Answer, factored'); ! $testsuite[] = stack_testsuite_construct('PartFrac','3*x*(1/(x+1) + 2/(x+2))','3*x/(x+1)+6*x/(x+2)',1,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','(3*x+3)*(1/(x+1) + 2/(x+2))','(3*x+3)/(x+1)+(6*x+6)/(x+2)',1,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','10/(x+3) - 2/(x+2) + x -2','(x^3 + 3*x^2 + 4*x +2)/((x+2)*(x+3))',1,'x','Correct Answer, Numerator > Denominator'); --- 150,156 ---- $testsuite[] = stack_testsuite_construct('PartFrac','1/n','1/n',0,'n',''); $testsuite[] = stack_testsuite_construct('PartFrac','1/(n+1)-1/n','1/(n+1)-1/n',1,'n','A simple correct answer'); ! $testsuite[] = stack_testsuite_construct('PartFrac','3/(x+1) + 3/(x+2)','3*(2*x+3)/((x+1)*(x+2))',1,'x','2 answers to the same question'); ! $testsuite[] = stack_testsuite_construct('PartFrac','3*(1/(x+1) + 1/(x+2))','3*(2*x+3)/((x+1)*(x+2))',1,'x',''); ! $testsuite[] = stack_testsuite_construct('PartFrac','3*x*(1/(x+1) + 2/(x+2))','3*x/(x+1)+6*x/(x+2)',1,'x','Correct Answer, factored'); $testsuite[] = stack_testsuite_construct('PartFrac','(3*x+3)*(1/(x+1) + 2/(x+2))','(3*x+3)/(x+1)+(6*x+6)/(x+2)',1,'x',''); $testsuite[] = stack_testsuite_construct('PartFrac','10/(x+3) - 2/(x+2) + x -2','(x^3 + 3*x^2 + 4*x +2)/((x+2)*(x+3))',1,'x','Correct Answer, Numerator > Denominator'); |
From: LastRenshai <las...@us...> - 2005-08-16 12:34:34
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv465/scripts/maxima Modified Files: stackmaxima.mac Log Message: Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** stackmaxima.mac 5 Aug 2005 09:13:44 -0000 1.24 --- stackmaxima.mac 16 Aug 2005 12:34:14 -0000 1.25 *************** *** 654,657 **** --- 654,737 ---- )$ + + /* ************************ATSingFracTest****************************** */ + /* requires: Student Answer */ + /* List: [Teachers Answer, variable with which partial */ + /* fraction occurs, whether Formative Feedback is required */ + /* returns: StackReturnOb */ + /* Cases: */ + /* Returns True iff algerbraic equivalence with TList[1] */ + /* and Division is the Top Operator. */ + /* False if Division not the top operator */ + /* False if different Variables are used */ + /* True(0) otherwise */ + /* ******************************************************************** */ + ATSingFrac(sExpr, TList):= BLOCK( + [NEGDISTRIB, val, rawmk, fb, ansnote, tExpr, quiet, facdum], + NEGDISTRIB: FALSE, val:"", rawmk:"1", + fb: StackAddFeedback("","AT_NOTIMPLEMENTED"), + ansnote:"", + if listp(TList) then + BLOCK + ( tExpr: TList[1], wrt: TList[2], quiet: TList[3] ) + else + RETURN(StackReturnOb("false","0","ATFacForm_error_list",StackAddFeedback("","ATSingFrac_error_list"))), + BLOCK + ( + [val, rawmk,ansnote,fb], + rawmk: 0, fb: "", ansnote: "", ret: + StackReturnOb(val,rawmk,ansnote,fb), + if factor( expand ( sExpr ) ) = factor( expand( tExpr ) ) then + BLOCK + ( + topOp: op(sExpr), + if topOp = "//" then + BLOCK + ( + val:"true", + rawmk:"1", + ansnote: "ATSingFrac_true", + fb: StackAddFeedback("",ansnote) + ) + else + BLOCK + ( + val:"false", + rawmk:"0", + ansnote:"ATSingFrac_part", + fb: StackAddFeedback("",ansnote) + ), + ret: StackReturnOb(val,rawmk,ansnote,fb) + ) + else if (sameVars(sExpr, tExpr) # true) then + BLOCK + ( + val:"false", + rawmk:"0", + ansnote:"ATSingFrac_var", + fb: StackAddFeedback("",ansnote) + ) + else if (partFrac(sExpr,wrt) # sExpr) then + BLOCK + ( + val: "true", + rawmk:"0", + ansnote:"ATSingFrac_ret_Q", + fb: StackAddFeedback("",ansnote, StackDISP(partFrac(sExpr, wrt), "\$")) + ) + else + BLOCK + ( + val:"true", + rawmk:"0", + ansnote:"ATSingFrac_ret_exp", + fb: StackAddFeedback("",ansnote, StackDISP(factor(sExpr),"\$")) + ), + ret: StackReturnOb(val,rawmk,ansnote,fb), + if quiet # TRUE then fb:"", + RETURN(ret) + ) + )$ + /*********************/ /* Calculus question */ |
From: Chris S. <san...@us...> - 2005-08-16 11:23:04
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18633 Modified Files: Tag: development_xmlrqp quiz.php Log Message: Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.25 retrieving revision 1.25.2.1 diff -C2 -d -r1.25 -r1.25.2.1 *** quiz.php 14 Jul 2005 18:26:03 -0000 1.25 --- quiz.php 16 Aug 2005 11:22:51 -0000 1.25.2.1 *************** *** 52,55 **** --- 52,59 ---- } + // Now datetime + $tnow = time(); + $dtnow = date("F j, Y, g:i a"); + //////////////////////////////////////////////// // (3) Decide what we are trying to do. *************** *** 482,485 **** --- 486,491 ---- stack_page_header($title,''); + echo "\n<a name='top'></a>\n"; + // Add javascript for quiz forms require_once("{$stack_root}/html/quizjava.html"); *************** *** 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> --- 542,573 ---- 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) { 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) { 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> *************** *** 679,682 **** --- 686,690 ---- } + echo "\n<a name='bottom'></a>\n"; stack_page_footer(); |
From: Chris S. <san...@us...> - 2005-08-16 11:23:04
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18633/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackQuestion.php stackUtility.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.5 retrieving revision 1.29.2.6 diff -C2 -d -r1.29.2.5 -r1.29.2.6 *** stackAuthor.php 16 Aug 2005 10:08:09 -0000 1.29.2.5 --- stackAuthor.php 16 Aug 2005 11:22:51 -0000 1.29.2.6 *************** *** 683,690 **** } ! //<PDK> Now datetime ! $t=time(); $dts = strftime('%c',$t); // Format the string. ! // Timestamp this edit echo "<form name='stackquizeditform' action='$PostTo' method='POST'>\n"; --- 683,699 ---- } ! // Now datetime ! $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"; *************** *** 707,716 **** if ('quizid' == $key) { echo "<td><input type=\"hidden\" name=\"quiz[$key]\" value=\"{$quiz[$key]}\" alt=\"$key\" />{$quiz[$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"; echo "<p><b>Questions attached to this quiz:</b><br />(An empty order field indicates they are attached but hidden)"; --- 716,739 ---- 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 ('' != $quiz[$key]) { + $stimestr = strftime('%c',$quiz[$key]); + } + echo "<td><input type=\"text\" name=\"quiz[$key]\" 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('ShowSol','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)"; *************** *** 748,769 **** 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']; - } - } - $optval = stack_options_formvals_set($quiz_options); ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','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,$optval,$fieldname); ! //Check if quiz has metadata set // $fieldname = 'quiz' $metadata_list = array('quizLanguage','quizLearningContext','quizDifficulty','quizCompetency', --- 771,782 ---- 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', *************** *** 898,902 **** } ! // (5) Update the quiz information itself stack_db_quiz_update($quiz); --- 911,920 ---- } ! // (5) Sort out any time stamp for the due date. ! if ('' != $quiz['quizDueDate']) { ! $quiz['quizDueDate'] = strtotime($quiz['quizDueDate']); ! } ! ! // (\infty) Update the quiz information itself stack_db_quiz_update($quiz); Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.30.2.3 retrieving revision 1.30.2.4 diff -C2 -d -r1.30.2.3 -r1.30.2.4 *** stackUtility.php 15 Aug 2005 16:09:23 -0000 1.30.2.3 --- stackUtility.php 16 Aug 2005 11:22:51 -0000 1.30.2.4 *************** *** 91,95 **** } - /** * Checks for the presence of a $field kind of error in $error --- 91,94 ---- *************** *** 1058,1077 **** * * @param void ! * @return int phpVer The major revision of PHP in use ! * false if this information not available * */ function stack_php_version() { ! ! $phpVer = phpversion(); //Retrieve PHP version string ! ! //Retreive and return major revision of PHP ! if (!empty($phpVer)) { ! return $phpVer{0}; ! } ! ! else { ! return false; ! } } ?> --- 1057,1076 ---- * * @param void ! * @return int phpVer The major revision of PHP in use ! * false if this information not available * */ function stack_php_version() { ! ! $phpVer = phpversion(); //Retrieve PHP version string ! ! //Retreive and return major revision of PHP ! if (!empty($phpVer)) { ! return $phpVer{0}; ! } ! ! else { ! return false; ! } } ?> Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30.2.7 retrieving revision 1.30.2.8 diff -C2 -d -r1.30.2.7 -r1.30.2.8 *** stackQuestion.php 16 Aug 2005 10:08:09 -0000 1.30.2.7 --- stackQuestion.php 16 Aug 2005 11:22:51 -0000 1.30.2.8 *************** *** 115,119 **** // 'Show solution'; $stackOptions['ShowSol']['type']='list'; ! $stackOptions['ShowSol']['values']=array('Always','Never','On request','After correct answer'); $stackOptions['ShowSol']['default']='On request'; --- 115,119 ---- // 'Show solution'; $stackOptions['ShowSol']['type']='list'; ! $stackOptions['ShowSol']['values']=array('After Due Date','On request','Always','Never','After correct answer',); $stackOptions['ShowSol']['default']='On request'; |
From: Chris S. <san...@us...> - 2005-08-16 11:23:02
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18633/lang/en Modified Files: Tag: development_xmlrqp stack.php Log Message: Index: stack.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/lang/en/stack.php,v retrieving revision 1.16 retrieving revision 1.16.2.1 diff -C2 -d -r1.16 -r1.16.2.1 *** stack.php 25 Jul 2005 11:24:08 -0000 1.16 --- stack.php 16 Aug 2005 11:22:51 -0000 1.16.2.1 *************** *** 38,42 **** $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 />'; --- 38,43 ---- $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 />'; |
From: Chris S. <san...@us...> - 2005-08-16 10:08:24
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4580/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackQuestion.php stackQuiz.php Log Message: Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5.2.2 retrieving revision 1.5.2.3 diff -C2 -d -r1.5.2.2 -r1.5.2.3 *** stackQuiz.php 15 Aug 2005 16:09:23 -0000 1.5.2.2 --- stackQuiz.php 16 Aug 2005 10:08:09 -0000 1.5.2.3 *************** *** 14,31 **** $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'; --- 14,31 ---- $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'; *************** *** 33,62 **** $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'; // 'Last edited by'; --- 33,62 ---- $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'; // 'Last edited by'; *************** *** 64,68 **** $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; $stackQuiz['quizUserLastEdited']['type']='meta'; ! $stackQuiz['quizUserLastEdited']['metatag']='creator'; //dc:creator $stackQuiz['quizUserLastEdited']['metatype']='dublincore'; --- 64,68 ---- $stackQuiz['quizUserLastEdited']['mysql']='INT UNSIGNED'; $stackQuiz['quizUserLastEdited']['type']='meta'; ! $stackQuiz['quizUserLastEdited']['metatag']='creator'; //dc:creator $stackQuiz['quizUserLastEdited']['metatype']='dublincore'; *************** *** 71,75 **** $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; $stackQuiz['quizDateLastEdited']['type']='meta'; ! $stackQuiz['quizDateLastEdited']['metatag']='date'; //dc:date $stackQuiz['quizDateLastEdited']['metatype']='dublincore'; --- 71,75 ---- $stackQuiz['quizDateLastEdited']['mysql']='TIMESTAMP'; $stackQuiz['quizDateLastEdited']['type']='meta'; ! $stackQuiz['quizDateLastEdited']['metatag']='date'; //dc:date $stackQuiz['quizDateLastEdited']['metatype']='dublincore'; *************** *** 78,82 **** $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; $stackQuiz['quizPublisher']['type']='meta'; ! $stackQuiz['quizPublisher']['metatag']='publisher'; //dc:publisher $stackQuiz['quizPublisher']['metatype']='dublincore'; --- 78,82 ---- $stackQuiz['quizPublisher']['mysql']='TINYTEXT'; $stackQuiz['quizPublisher']['type']='meta'; ! $stackQuiz['quizPublisher']['metatag']='publisher'; //dc:publisher $stackQuiz['quizPublisher']['metatype']='dublincore'; *************** *** 86,90 **** $stackQuiz['type']['mysql']='TINYTEXT'; $stackQuiz['type']['type']='meta'; ! $stackQuiz['type']['metatag']='type'; //dc:type $stackQuiz['type']['metatype']='dublincore'; --- 86,90 ---- $stackQuiz['type']['mysql']='TINYTEXT'; $stackQuiz['type']['type']='meta'; ! $stackQuiz['type']['metatag']='type'; //dc:type $stackQuiz['type']['metatype']='dublincore'; *************** *** 95,99 **** $stackQuiz['quizFormat']['required']='optional'; $stackQuiz['quizFormat']['mysql']='TINYTEXT'; ! $stackQuiz['quizFormat']['type']='meta'; //dc:format $stackQuiz['quizFormat']['metatag']='format'; $stackQuiz['quizFormat']['metatype']='dublincore'; --- 95,99 ---- $stackQuiz['quizFormat']['required']='optional'; $stackQuiz['quizFormat']['mysql']='TINYTEXT'; ! $stackQuiz['quizFormat']['type']='meta'; //dc:format $stackQuiz['quizFormat']['metatag']='format'; $stackQuiz['quizFormat']['metatype']='dublincore'; *************** *** 104,108 **** $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; $stackQuiz['quizLanguage']['type']='meta'; ! $stackQuiz['quizLanguage']['metatag']='language'; //dc:language $stackQuiz['quizLanguage']['metatype']='dublincore'; $stackQuiz['quizLanguage']['default']='unspecified'; --- 104,108 ---- $stackQuiz['quizLanguage']['mysql']='TINYTEXT'; $stackQuiz['quizLanguage']['type']='meta'; ! $stackQuiz['quizLanguage']['metatag']='language'; //dc:language $stackQuiz['quizLanguage']['metatype']='dublincore'; $stackQuiz['quizLanguage']['default']='unspecified'; *************** *** 112,116 **** $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'; --- 112,116 ---- $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'; *************** *** 124,128 **** $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; $stackQuiz['quizLearningContext']['type']='meta'; ! $stackQuiz['quizLearningContext']['metatag']='context'; //lom:context $stackQuiz['quizLearningContext']['metatype']='lom'; $stackQuiz['quizLearningContext']['default']='unspecified'; --- 124,128 ---- $stackQuiz['quizLearningContext']['mysql']='TINYTEXT'; $stackQuiz['quizLearningContext']['type']='meta'; ! $stackQuiz['quizLearningContext']['metatag']='context'; //lom:context $stackQuiz['quizLearningContext']['metatype']='lom'; $stackQuiz['quizLearningContext']['default']='unspecified'; *************** *** 134,138 **** $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; $stackQuiz['quizDifficulty']['type']='meta'; ! $stackQuiz['quizDifficulty']['metatag']='difficulty'; //lom:difficulty $stackQuiz['quizDifficulty']['metatype']='lom'; $stackQuiz['quizDifficulty']['default']='unspecified'; --- 134,138 ---- $stackQuiz['quizDifficulty']['mysql']='TINYTEXT'; $stackQuiz['quizDifficulty']['type']='meta'; ! $stackQuiz['quizDifficulty']['metatag']='difficulty'; //lom:difficulty $stackQuiz['quizDifficulty']['metatype']='lom'; $stackQuiz['quizDifficulty']['default']='unspecified'; *************** *** 146,150 **** $stackQuiz['quizCompetency']['type']='meta'; $stackQuiz['quizCompetency']['metatag']='competency'; ! $stackQuiz['quizCompetency']['metatype']='stack'; //competency $stackQuiz['quizCompetency']['default']='unspecified'; --- 146,150 ---- $stackQuiz['quizCompetency']['type']='meta'; $stackQuiz['quizCompetency']['metatag']='competency'; ! $stackQuiz['quizCompetency']['metatype']='stack'; //competency $stackQuiz['quizCompetency']['default']='unspecified'; *************** *** 155,159 **** $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; $stackQuiz['quizCompetencyLevel']['type']='meta'; ! $stackQuiz['quizCompetencyLevel']['metatag']='competencylevel'; //competencylevel $stackQuiz['quizCompetencyLevel']['metatype']='stack'; $stackQuiz['quizCompetencyLevel']['default']='unspecified'; --- 155,159 ---- $stackQuiz['quizCompetencyLevel']['mysql']='TINYTEXT'; $stackQuiz['quizCompetencyLevel']['type']='meta'; ! $stackQuiz['quizCompetencyLevel']['metatag']='competencylevel'; //competencylevel $stackQuiz['quizCompetencyLevel']['metatype']='stack'; $stackQuiz['quizCompetencyLevel']['default']='unspecified'; *************** *** 163,167 **** $stackQuiz['quizTimeAllocated']['mysql']='TIME'; $stackQuiz['quizTimeAllocated']['type']='meta'; ! $stackQuiz['quizTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime $stackQuiz['quizTimeAllocated']['metatype']='lom'; $stackQuiz['quizTimeAllocated']['default']='0'; --- 163,167 ---- $stackQuiz['quizTimeAllocated']['mysql']='TIME'; $stackQuiz['quizTimeAllocated']['type']='meta'; ! $stackQuiz['quizTimeAllocated']['metatag']='typicallearningtime'; //lom:typicallearningtime $stackQuiz['quizTimeAllocated']['metatype']='lom'; $stackQuiz['quizTimeAllocated']['default']='0'; *************** *** 173,177 **** $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; $stackQuiz['quizExcerciseType']['type']='meta'; ! $stackQuiz['quizExcerciseType']['metatag']='excercisetype'; //excercisetype $stackQuiz['quizExcerciseType']['metatype']='stack'; $stackQuiz['quizExcerciseType']['default']='unspecified'; --- 173,177 ---- $stackQuiz['quizExcerciseType']['mysql']='TINYTEXT'; $stackQuiz['quizExcerciseType']['type']='meta'; ! $stackQuiz['quizExcerciseType']['metatag']='excercisetype'; //excercisetype $stackQuiz['quizExcerciseType']['metatype']='stack'; $stackQuiz['quizExcerciseType']['default']='unspecified'; Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.4 retrieving revision 1.29.2.5 diff -C2 -d -r1.29.2.4 -r1.29.2.5 *** stackAuthor.php 16 Aug 2005 09:45:04 -0000 1.29.2.4 --- stackAuthor.php 16 Aug 2005 10:08:09 -0000 1.29.2.5 *************** *** 676,679 **** --- 676,680 ---- */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { + global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; *************** *** 689,693 **** echo "<form name='stackquizeditform' action='$PostTo' method='POST'>\n"; ! //<PDK> Hidden metadata echo "<input type='hidden' name='quizDateLastEdited' value='$t' />\n <input type='hidden' name='quizPublisher' value='".sf($quiz,'quizPublisher')."' />\n --- 690,694 ---- echo "<form name='stackquizeditform' action='$PostTo' method='POST'>\n"; ! // Hidden metadata echo "<input type='hidden' name='quizDateLastEdited' value='$t' />\n <input type='hidden' name='quizPublisher' value='".sf($quiz,'quizPublisher')."' />\n *************** *** 695,714 **** <input type='hidden' name='quizFormat' value='".sf($quiz,'quizFormat')."' />\n"; ! // Edit the quiz - dont iterate through metadata tags! ! echo "\n<table>\n"; ! foreach ($stackQuiz as $key => $fields) { //Check that within current field there is no type tag, otherwise skip ! if (empty($fields['type'])){ ! $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"; --- 696,714 ---- <input type='hidden' name='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'); ! 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 { ! 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"; *************** *** 757,760 **** --- 757,761 ---- } } + $optval = stack_options_formvals_set($quiz_options); $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','','','','','',get_string('stackOptions_edit_out','stack'),'',''); *************** *** 762,766 **** $fieldname = 'quiz[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$quiz_options,$fieldname); //Check if quiz has metadata set --- 763,767 ---- $fieldname = 'quiz[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname); //Check if quiz has metadata set *************** *** 813,817 **** stack_options_validate($quiz['quizOptions']); } ! if (array_key_exists('questions',$quiz)) { // (2) Drop any questions no longer used. --- 814,818 ---- stack_options_validate($quiz['quizOptions']); } ! if (array_key_exists('questions',$quiz)) { // (2) Drop any questions no longer used. *************** *** 873,878 **** } - - } // End of if (array_key_exists('questions',$quiz)) .... --- 874,877 ---- Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30.2.6 retrieving revision 1.30.2.7 diff -C2 -d -r1.30.2.6 -r1.30.2.7 *** stackQuestion.php 16 Aug 2005 09:45:04 -0000 1.30.2.6 --- stackQuestion.php 16 Aug 2005 10:08:09 -0000 1.30.2.7 *************** *** 213,219 **** // 'Unique question ID'; ! $stackQuestion['questionID']['type']='meta'; ! $stackQuestion['questionID']['required']='system'; ! $stackQuestion['questionID']['mysql']='INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; // 'Globally unique question ID'; --- 213,219 ---- // 'Unique question ID'; ! $stackQuestion['questionID']['type'] = 'meta'; ! $stackQuestion['questionID']['required'] = 'system'; ! $stackQuestion['questionID']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; // 'Globally unique question ID'; |
From: Chris S. <san...@us...> - 2005-08-16 09:45:13
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv433/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackQuestion.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.3 retrieving revision 1.29.2.4 diff -C2 -d -r1.29.2.3 -r1.29.2.4 *** stackAuthor.php 12 Aug 2005 17:16:47 -0000 1.29.2.3 --- stackAuthor.php 16 Aug 2005 09:45:04 -0000 1.29.2.4 *************** *** 104,107 **** --- 104,130 ---- + /** + * 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; + } + + //****************************************************** //** Edit question *************** *** 152,171 **** $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. --- 175,184 ---- $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. *************** *** 176,183 **** <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='questionType' value='".sf($question,'questionType')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! <table cellboarder='0' cellpadding='2'> <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> --- 189,196 ---- <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='questionType' value='".sf($question,'questionType')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! <table cellboarder='0' cellpadding='2'> <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> *************** *** 187,193 **** <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. --- 200,206 ---- <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. *************** *** 348,353 **** $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"; --- 361,366 ---- $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"; *************** *** 678,690 **** //<PDK> Hidden metadata echo "<input type='hidden' name='quizDateLastEdited' value='$t' />\n ! <input type='hidden' name='quizPublisher' value='".sf($quiz,'quizPublisher')."' />\n ! <input type='hidden' name='type' value='".sf($quiz,'type')."' />\n ! <input type='hidden' name='quizFormat' value='".sf($quiz,'quizFormat')."' />\n"; // Edit the quiz - dont iterate through metadata tags! echo "\n<table>\n"; foreach ($stackQuiz as $key => $fields) { ! //Check that within current field there is no type tag, otherwise skip ! if (empty($fields['type'])){ $err = ''; echo "<tr><td><b>{$fields['descript']}</b></td>\n"; --- 691,703 ---- //<PDK> Hidden metadata echo "<input type='hidden' name='quizDateLastEdited' value='$t' />\n ! <input type='hidden' name='quizPublisher' value='".sf($quiz,'quizPublisher')."' />\n ! <input type='hidden' name='type' value='".sf($quiz,'type')."' />\n ! <input type='hidden' name='quizFormat' value='".sf($quiz,'quizFormat')."' />\n"; // Edit the quiz - dont iterate through metadata tags! echo "\n<table>\n"; foreach ($stackQuiz as $key => $fields) { ! //Check that within current field there is no type tag, otherwise skip ! if (empty($fields['type'])){ $err = ''; echo "<tr><td><b>{$fields['descript']}</b></td>\n"; *************** *** 750,754 **** stack_options_edit_form($options_headings,$options_list,$quiz_options,$fieldname); ! //Check if quiz has metadata set // $fieldname = 'quiz' --- 763,767 ---- stack_options_edit_form($options_headings,$options_list,$quiz_options,$fieldname); ! //Check if quiz has metadata set // $fieldname = 'quiz' *************** *** 912,919 **** //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) { --- 925,932 ---- //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) { *************** *** 923,931 **** echo " </select>\n"; ! } ! ! else { ! echo "<input type='text' name='$name' value ='".stack_s($optval)."' size = '$sz' />"; ! } } } --- 936,944 ---- echo " </select>\n"; ! } ! ! else { ! echo "<input type='text' name='$name' value ='".stack_s($optval)."' size = '$sz' />"; ! } } } *************** *** 939,968 **** */ 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]); //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"; } ! ! //print_r($question); ! echo "\n</table>\n\n\n"; } --- 952,981 ---- */ 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]); //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"; } ! ! //print_r($question); ! echo "\n</table>\n\n\n"; } *************** *** 986,993 **** //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) { --- 999,1006 ---- //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) { *************** *** 997,1005 **** echo " </select>\n"; ! } ! ! else { ! echo "<input type='text' name='$name' value ='".stack_s($optval)."' size = '$sz' />"; ! } //$fields = $stackQuiz[$opt]; } } --- 1010,1018 ---- echo " </select>\n"; ! } ! ! else { ! echo "<input type='text' name='$name' value ='".stack_s($optval)."' size = '$sz' />"; ! } //$fields = $stackQuiz[$opt]; } } *************** *** 1021,1040 **** <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 $fieldname= 'quiz'.'['.$metadata.']'; echo " <td> $descript </td>\n <td>"; ! @stack_quiz_edit_metadata_field($fieldname,$metadata,$quiz[$metadata]); //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"; } --- 1034,1053 ---- <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 $fieldname= 'quiz'.'['.$metadata.']'; echo " <td> $descript </td>\n <td>"; ! @stack_quiz_edit_metadata_field($fieldname,$metadata,$quiz[$metadata]); //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"; } Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30.2.5 retrieving revision 1.30.2.6 diff -C2 -d -r1.30.2.5 -r1.30.2.6 *** stackQuestion.php 12 Aug 2005 17:16:47 -0000 1.30.2.5 --- stackQuestion.php 16 Aug 2005 09:45:04 -0000 1.30.2.6 *************** *** 1,867 **** <?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 - [...4860 lines suppressed...] - if (is_array($seeds)) { - $seed = end($seeds); - } - - return($seed); - - } - - ?> - --- 1021,2161 ---- |
From: Chris S. <san...@us...> - 2005-08-16 09:45:13
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv433 Modified Files: Tag: development_xmlrqp question_bank.php Log Message: Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8.2.4 retrieving revision 1.8.2.5 diff -C2 -d -r1.8.2.4 -r1.8.2.5 *** question_bank.php 12 Aug 2005 13:51:54 -0000 1.8.2.4 --- question_bank.php 16 Aug 2005 09:45:04 -0000 1.8.2.5 *************** *** 133,137 **** 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"); --- 133,137 ---- 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"); |
From: pkiddie <pk...@us...> - 2005-08-15 16:53:55
|
Update of /cvsroot/stack/stack-1-0/html In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27996/html Modified Files: Tag: development_xmlrqp admin-menu.txt Log Message: New revision of DOMIT with better support for namespacing 'Import question' works Preliminary front-end script for importing questions/quizzes and question lists Index: admin-menu.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/html/admin-menu.txt,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** admin-menu.txt 14 Jul 2005 11:28:14 -0000 1.13 --- admin-menu.txt 15 Aug 2005 16:09:23 -0000 1.13.2.1 *************** *** 5,10 **** --- 5,13 ---- ..menu_New|question_bank.php?action=edit_new ..menu_Import|question_bank.php?action=import + ..menu_Import_PDK|import.php?action=import .menu_Quizzes|editquiz.php?action=quiz_choose ..menu_New|editquiz.php?action=quiz_new + ..menu_Import|editquiz.php?action=import + ..menu_Import_PDK|import.php?action=import .menu_Reporting|analysis.php .menu_User|user.php |
Update of /cvsroot/stack/stack-1-0/other/domit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27996/other/domit Modified Files: Tag: development_xmlrqp changelog.txt php_file_utilities.php php_http_client_generic.php 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_parser.php xml_domit_shared.php xml_domit_utilities.php xml_saxy_parser.php xml_saxy_shared.php Log Message: New revision of DOMIT with better support for namespacing 'Import question' works Preliminary front-end script for importing questions/quizzes and question lists Index: php_http_client_generic.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/php_http_client_generic.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** php_http_client_generic.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- php_http_client_generic.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 271,274 **** --- 271,275 ---- * Performs an HTTP GET * @param string The target url + * @return object An HTTP response object */ function &get($url) { *************** *** 296,299 **** --- 297,301 ---- * Performs an HTTP POST * @param string The posted data + * @return object An HTTP response object */ function &post($data) { *************** *** 318,321 **** --- 320,324 ---- * Performs an HTTP HEAD * @param string The target url + * @return object An HTTP response object */ function &head($url) { *************** *** 338,342 **** /** * Sends data through the client connection ! * @return string The body of the http response */ function &send($message) { --- 341,346 ---- /** * Sends data through the client connection ! * @param string The message to be sent ! * @return string The http response */ function &send($message) { Index: xml_domit_cache.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_cache.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_cache.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_cache.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 72,74 **** } //removeFromCache } //DOMIT_cache ! ?> --- 72,74 ---- } //removeFromCache } //DOMIT_cache ! ?> \ No newline at end of file Index: xml_domit_lite_parser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_lite_parser.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_lite_parser.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_lite_parser.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 4,8 **** * @package domit-xmlparser * @subpackage domit-xmlparser-lite ! * @version 0.18 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License --- 4,8 ---- * @package domit-xmlparser * @subpackage domit-xmlparser-lite ! * @version 0.2 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License *************** *** 17,21 **** /** current version of DOMIT! Lite */ ! define ('DOMIT_LITE_VERSION', '0.18'); /** --- 17,21 ---- /** current version of DOMIT! Lite */ ! define ('DOMIT_LITE_VERSION', '0.2'); /** *************** *** 35,39 **** * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Node { /** @var string The name of the node, varies according to node type */ var $nodeName = null; --- 35,39 ---- * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_Node { /** @var string The name of the node, varies according to node type */ var $nodeName = null; *************** *** 66,76 **** * Raises error if abstract class is directly instantiated */ ! function DOMIT_Node() { DOMIT_DOMException::raiseException(DOMIT_ABSTRACT_CLASS_INSTANTIATION_ERR, ! 'Cannot instantiate abstract class DOMIT_Node'); ! } //DOMIT_Node /** ! * DOMIT_Node constructor, assigns a uid */ function _constructor() { --- 66,76 ---- * Raises error if abstract class is directly instantiated */ ! function DOMIT_Lite_Node() { DOMIT_DOMException::raiseException(DOMIT_ABSTRACT_CLASS_INSTANTIATION_ERR, ! 'Cannot instantiate abstract class DOMIT_Lite_Node'); ! } //DOMIT_Lite_Node /** ! * DOMIT_Lite_Node constructor, assigns a uid */ function _constructor() { *************** *** 161,165 **** function &cloneNode($deep = false) { DOMIT_DOMException::raiseException(DOMIT_ABSTRACT_METHOD_INVOCATION_ERR, ! 'Cannot invoke abstract method DOMIT_Node->cloneNode($deep). Must provide an overridden method in your subclass.'); } //cloneNode --- 161,165 ---- function &cloneNode($deep = false) { DOMIT_DOMException::raiseException(DOMIT_ABSTRACT_METHOD_INVOCATION_ERR, ! 'Cannot invoke abstract method DOMIT_Lite_Node->cloneNode($deep). Must provide an overridden method in your subclass.'); } //cloneNode *************** *** 170,174 **** */ function getNamedElements(&$nodeList, $tagName) { ! //Implemented in DOMIT_Element. //Needs to be here though! This is called against all nodes in the document. } //getNamedElements --- 170,174 ---- */ function getNamedElements(&$nodeList, $tagName) { ! //Implemented in DOMIT_Lite_Element. //Needs to be here though! This is called against all nodes in the document. } //getNamedElements *************** *** 252,256 **** function onLoad() { //you can override this method if you subclass any of the ! //DOMIT_Nodes. It's a way of performing //initialization of your subclass as soon as the document //has been loaded (as opposed to as soon as the current node --- 252,256 ---- function onLoad() { //you can override this method if you subclass any of the ! //DOMIT_Lite_Nodes. It's a way of performing //initialization of your subclass as soon as the document //has been loaded (as opposed to as soon as the current node *************** *** 282,286 **** * @return string The formatted string representation */ ! function toNormalizedString($htmlSafe = false, $subEntities=false) { //require this file for generating a normalized (readable) xml string representation require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); --- 282,286 ---- * @return string The formatted string representation */ ! function toNormalizedString($htmlSafe = false, $subEntities = false) { //require this file for generating a normalized (readable) xml string representation require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); *************** *** 293,297 **** return $result; } //toNormalizedString ! } //DOMIT_Node --- 293,297 ---- return $result; } //toNormalizedString ! } //DOMIT_Lite_Node *************** *** 303,314 **** * @author John Heinstein <joh...@nb...> */ ! class DOMIT_ChildNodes_Interface extends DOMIT_Node { /** * Raises error if abstract class is directly instantiated */ ! function DOMIT_ChildNodes_Interface() { DOMIT_DOMException::raiseException(DOMIT_ABSTRACT_CLASS_INSTANTIATION_ERR, ! 'Cannot instantiate abstract class DOMIT_ChildNodes_Interface'); ! } //DOMIT_ChildNodes_Interface /** --- 303,314 ---- * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_ChildNodes_Interface extends DOMIT_Lite_Node { /** * Raises error if abstract class is directly instantiated */ ! function DOMIT_Lite_ChildNodes_Interface() { DOMIT_DOMException::raiseException(DOMIT_ABSTRACT_CLASS_INSTANTIATION_ERR, ! 'Cannot instantiate abstract class DOMIT_Lite_ChildNodes_Interface'); ! } //DOMIT_Lite_ChildNodes_Interface /** *************** *** 541,548 **** * @param string The name of the attribute * @param boolean True if the first found node is to be returned as a node instead of a nodelist * @return object A NodeList of found elements, or null */ function &getElementsByAttribute($attrName = 'id', $attrValue = '', ! $returnFirstFoundNode = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_nodemaps.php'); --- 541,549 ---- * @param string The name of the attribute * @param boolean True if the first found node is to be returned as a node instead of a nodelist + * @param boolean True if uid is to be considered an attribute * @return object A NodeList of found elements, or null */ function &getElementsByAttribute($attrName = 'id', $attrValue = '', ! $returnFirstFoundNode = false, $treatUIDAsAttribute = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_nodemaps.php'); *************** *** 551,556 **** switch ($this->nodeType) { case DOMIT_ELEMENT_NODE: ! $this->_getElementsByAttribute($nodelist, $attrName = 'id', $attrValue, ! $returnFirstFoundNode); break; --- 552,557 ---- switch ($this->nodeType) { case DOMIT_ELEMENT_NODE: ! $this->_getElementsByAttribute($nodelist, $attrName, $attrValue, ! $returnFirstFoundNode, $treatUIDAsAttribute); break; *************** *** 558,562 **** if ($this->documentElement != null) { $this->documentElement->_getElementsByAttribute($nodelist, ! $attrName, $attrValue, $returnFirstFoundNode); } break; --- 559,563 ---- if ($this->documentElement != null) { $this->documentElement->_getElementsByAttribute($nodelist, ! $attrName, $attrValue, $returnFirstFoundNode, $treatUIDAsAttribute); } break; *************** *** 567,577 **** return $nodelist->item(0); } ! else { ! return null; ! } ! } ! else { ! return $nodelist; } } //getElementsByAttribute --- 568,575 ---- return $nodelist->item(0); } ! return null; } + + return $nodelist; } //getElementsByAttribute *************** *** 582,591 **** * @param string The name of the attribute * @param boolean True if the first found node is to be returned as a node instead of a nodelist * @param boolean True the node has been found */ function _getElementsByAttribute(&$nodelist, $attrName, $attrValue, ! $returnFirstFoundNode, $foundNode = false) { if (!($foundNode && $returnFirstFoundNode)) { ! if ($this->getAttribute($attrName) == $attrValue) { $nodelist->appendNode($this); $foundNode = true; --- 580,591 ---- * @param string The name of the attribute * @param boolean True if the first found node is to be returned as a node instead of a nodelist + * @param boolean True if uid is to be considered an attribute * @param boolean True the node has been found */ function _getElementsByAttribute(&$nodelist, $attrName, $attrValue, ! $returnFirstFoundNode, $treatUIDAsAttribute, $foundNode = false) { if (!($foundNode && $returnFirstFoundNode)) { ! if (($this->getAttribute($attrName) == $attrValue) || ! ($treatUIDAsAttribute && ($attrName == 'uid') && ($this->uid == $attrValue))) { $nodelist->appendNode($this); $foundNode = true; *************** *** 600,611 **** if ($currNode->nodeType == DOMIT_ELEMENT_NODE) { $currNode->_getElementsByAttribute($nodelist, ! $attrName, $attrValue, ! $returnFirstFoundNode, $foundNode); ! } ! } } } //_getElementsByAttribute ! } //DOMIT_ChildNodes_Interface /** --- 600,610 ---- if ($currNode->nodeType == DOMIT_ELEMENT_NODE) { $currNode->_getElementsByAttribute($nodelist, ! $attrName, $attrValue, $returnFirstFoundNode, ! $treatUIDAsAttribute, $foundNode); ! } } } } //_getElementsByAttribute ! } //DOMIT_Lite_ChildNodes_Interface /** *************** *** 616,620 **** * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_Document extends DOMIT_ChildNodes_Interface { /** @var string The xml declaration text */ var $xmlDeclaration; --- 615,619 ---- * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_Document extends DOMIT_Lite_ChildNodes_Interface { /** @var string The xml declaration text */ var $xmlDeclaration; *************** *** 631,634 **** --- 630,635 ---- /** @var boolean If true, loadXML or parseXML will attempt to detect and repair invalid xml */ var $doResolveErrors = false; + /** @var boolean True if whitespace is to be preserved during parsing */ + var $preserveWhitespace = false; /** @var boolean If true, elements tags will be rendered to string as <element></element> rather than <element/> */ var $doExpandEmptyElementTags = false; *************** *** 641,644 **** --- 642,647 ---- /** @var object A reference to a http connection or proxy server, if one is required */ var $httpConnection = null; + /** @var boolean True if php_http_client_generic is to be used instead of PHP get_file_contents to retrieve xml data */ + var $doUseHTTPClient = false; /** *************** *** 681,684 **** --- 684,695 ---- /** + * Specifies whether DOMIT! preserves whitespace when parsing + * @param boolean True if whitespace is to be preserved + */ + function preserveWhitespace($truthVal) { + $this->preserveWhitespace = $truthVal; + } //preserveWhitespace + + /** * Specifies basic authentication for an http connection * @param string The user name *************** *** 714,717 **** --- 725,736 ---- /** + * Specifies whether an HTTP client should be used to establish a connection + * @param boolean True if an HTTP client is to be used to establish the connection + */ + function useHTTPClient($truthVal) { + $this->doUseHTTPClient = $truthVal; + } //useHTTPClient + + /** * Returns the error code from the underlying SAX parser * @return int The error code *************** *** 838,842 **** if ($type == DOMIT_ELEMENT_NODE) { if ($this->documentElement == null) { ! parent::insertBefore($newChild); $this->setDocumentElement($newChild); } --- 857,861 ---- if ($type == DOMIT_ELEMENT_NODE) { if ($this->documentElement == null) { ! parent::insertBefore($newChild, $refChild); $this->setDocumentElement($newChild); } *************** *** 874,883 **** /** ! * Creates a new DOMIT_Element node * @param string The tag name of the element * @return Object The new element */ function &createElement($tagName) { ! $node =& new DOMIT_Element($tagName); $node->ownerDocument =& $this; --- 893,902 ---- /** ! * Creates a new DOMIT_Lite_Element node * @param string The tag name of the element * @return Object The new element */ function &createElement($tagName) { ! $node =& new DOMIT_Lite_Element($tagName); $node->ownerDocument =& $this; *************** *** 891,895 **** */ function &createTextNode($data) { ! $node =& new DOMIT_TextNode($data); $node->ownerDocument =& $this; --- 910,914 ---- */ function &createTextNode($data) { ! $node =& new DOMIT_Lite_TextNode($data); $node->ownerDocument =& $this; *************** *** 898,907 **** /** ! * Creates a new DOMIT_CDataSection node * @param string The text of the CDATASection * @return Object The new CDATASection node */ function &createCDATASection($data) { ! $node =& new DOMIT_CDATASection($data); $node->ownerDocument =& $this; --- 917,926 ---- /** ! * Creates a new DOMIT_Lite_CDATASection node * @param string The text of the CDATASection * @return Object The new CDATASection node */ function &createCDATASection($data) { ! $node =& new DOMIT_Lite_CDATASection($data); $node->ownerDocument =& $this; *************** *** 968,972 **** if (DOMIT_Utilities::validateXML($xmlText)) { ! $domParser =& new DOMIT_Parser(); if ($useSAXY || (!function_exists('xml_parser_create'))) { --- 987,991 ---- if (DOMIT_Utilities::validateXML($xmlText)) { ! $domParser =& new DOMIT_Lite_Parser(); if ($useSAXY || (!function_exists('xml_parser_create'))) { *************** *** 985,991 **** return $success; } ! else { ! return false; ! } } //parseXML --- 1004,1009 ---- return $success; } ! ! return false; } //parseXML *************** *** 1017,1020 **** --- 1035,1051 ---- /** + * Establishes a connection, given an url + * @param string The url of the data + */ + function establishConnection($url) { + require_once(DOMIT_INCLUDE_PATH . 'php_http_client_generic.php'); + + $host = php_http_connection::formatHost($url); + $host = substr($host, 0, strpos($host, '/')); + + $this->setConnection($host); + } //establishConnection + + /** * Retrieves text from a file * @param string The file path *************** *** 1022,1025 **** --- 1053,1060 ---- */ function getTextFromFile($filename) { + if ($this->doUseHTTPClient && (substr($filename, 0, 5) == 'http:')) { + $this->establishConnection($filename); + } + if ($this->httpConnection != null) { $response =& $this->httpConnection->get($filename); *************** *** 1111,1117 **** return $root->getText(); } ! else { ! return ''; ! } } //getText --- 1146,1151 ---- return $root->getText(); } ! ! return ''; } //getText *************** *** 1219,1223 **** * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities=false) { $result = ''; $total = $this->childCount; --- 1253,1257 ---- * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities = false) { $result = ''; $total = $this->childCount; *************** *** 1240,1249 **** * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Element extends DOMIT_ChildNodes_Interface { /** * DOM Element constructor * @param string The tag name of the element */ ! function DOMIT_Element($tagName) { $this->_constructor(); $this->nodeType = DOMIT_ELEMENT_NODE; --- 1274,1283 ---- * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_Element extends DOMIT_Lite_ChildNodes_Interface { /** * DOM Element constructor * @param string The tag name of the element */ ! function DOMIT_Lite_Element($tagName) { $this->_constructor(); $this->nodeType = DOMIT_ELEMENT_NODE; *************** *** 1251,1255 **** $this->attributes = array(); $this->childNodes = array(); ! } //DOMIT_Element /** --- 1285,1289 ---- $this->attributes = array(); $this->childNodes = array(); ! } //DOMIT_Lite_Element /** *************** *** 1352,1355 **** --- 1386,1393 ---- return $this->attributes[$name]; } + else { + DOMIT_DOMException::raiseException(DOMIT_NOT_FOUND_ERR, + ('No attribute named ' . $name . 'exists.')); + } } //getAttribute *************** *** 1452,1456 **** * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities=false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); global $DOMIT_defined_entities_flip; --- 1490,1494 ---- * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); global $DOMIT_defined_entities_flip; *************** *** 1461,1466 **** foreach ($this->attributes as $key => $value) { $result .= ' ' . $key . '="'; ! $result .= ($subEntities ? DOMIT_Utilities::convertEntities($value, ! $DOMIT_defined_entities_flip) : $value); $result .= '"'; } --- 1499,1504 ---- foreach ($this->attributes as $key => $value) { $result .= ' ' . $key . '="'; ! $result .= $subEntities ? DOMIT_Utilities::convertEntities($value, ! $DOMIT_defined_entities_flip) : $value; $result .= '"'; } *************** *** 1503,1507 **** return $result; } //toString ! } //DOMIT_Element /** --- 1541,1545 ---- return $result; } //toString ! } //DOMIT_Lite_Element /** *************** *** 1512,1526 **** * @author John Heinstein <joh...@nb...> */ ! class DOMIT_TextNode extends DOMIT_Node { /** * DOM Text Node constructor * @param string The text of the node */ ! function DOMIT_TextNode($data) { $this->_constructor(); $this->nodeType = DOMIT_TEXT_NODE; $this->nodeName = '#text'; $this->setText($data); ! } //DOMIT_TextNode /** --- 1550,1564 ---- * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_TextNode extends DOMIT_Lite_Node { /** * DOM Text Node constructor * @param string The text of the node */ ! function DOMIT_Lite_TextNode($data) { $this->_constructor(); $this->nodeType = DOMIT_TEXT_NODE; $this->nodeName = '#text'; $this->setText($data); ! } //DOMIT_Lite_TextNode /** *************** *** 1566,1575 **** * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities=false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); global $DOMIT_defined_entities_flip; ! $result = ($subEntities ? DOMIT_Utilities::convertEntities($this->nodeValue, ! $DOMIT_defined_entities_flip) : $this->nodeValue); if ($htmlSafe) $result = $this->forHTML($result); --- 1604,1613 ---- * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities = false) { require_once(DOMIT_INCLUDE_PATH . 'xml_domit_utilities.php'); global $DOMIT_defined_entities_flip; ! $result = $subEntities ? DOMIT_Utilities::convertEntities($this->nodeValue, ! $DOMIT_defined_entities_flip) : $this->nodeValue; if ($htmlSafe) $result = $this->forHTML($result); *************** *** 1577,1581 **** return $result; } //toString ! } //DOMIT_TextNode /** --- 1615,1619 ---- return $result; } //toString ! } //DOMIT_Lite_TextNode /** *************** *** 1586,1600 **** * @author John Heinstein <joh...@nb...> */ ! class DOMIT_CDATASection extends DOMIT_TextNode { /** * DOM CDATA Section node constructor * @param string The text of the node */ ! function DOMIT_CDATASection($data) { $this->_constructor(); $this->nodeType = DOMIT_CDATA_SECTION_NODE; $this->nodeName = '#cdata-section'; $this->setText($data); ! } //DOMIT_CDATASection /** --- 1624,1638 ---- * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_CDATASection extends DOMIT_Lite_TextNode { /** * DOM CDATA Section node constructor * @param string The text of the node */ ! function DOMIT_Lite_CDATASection($data) { $this->_constructor(); $this->nodeType = DOMIT_CDATA_SECTION_NODE; $this->nodeName = '#cdata-section'; $this->setText($data); ! } //DOMIT_Lite_CDATASection /** *************** *** 1604,1608 **** * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities=false) { $result = '<![CDATA['; $result .= $subEntities ? str_replace("]]>", "]]>", $this->nodeValue) : --- 1642,1646 ---- * @return string The string representation */ ! function toString($htmlSafe = false, $subEntities = false) { $result = '<![CDATA['; $result .= $subEntities ? str_replace("]]>", "]]>", $this->nodeValue) : *************** *** 1614,1618 **** return $result; } //toString ! } //DOMIT_CDATASection /** --- 1652,1656 ---- return $result; } //toString ! } //DOMIT_Lite_CDATASection /** *************** *** 1623,1627 **** * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Parser { /** @var Object A reference to the resulting xmldoc */ var $xmlDoc = null; --- 1661,1665 ---- * @author John Heinstein <joh...@nb...> */ ! class DOMIT_Lite_Parser { /** @var Object A reference to the resulting xmldoc */ var $xmlDoc = null; *************** *** 1668,1676 **** xml_set_default_handler($parser, 'defaultDataElement'); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); ! xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); //parse out whitespace - (XML_OPTION_SKIP_WHITE = 1 does not //seem to work consistently across versions of PHP and Expat ! $xmlText = eregi_replace('>' . "[[:space:]]+" . '<' , '><', $xmlText); $success = xml_parse($parser, $xmlText); --- 1706,1722 ---- xml_set_default_handler($parser, 'defaultDataElement'); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); ! ! if (!$this->xmlDoc->preserveWhitespace) { ! xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); ! } ! else { ! xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 0); ! } //parse out whitespace - (XML_OPTION_SKIP_WHITE = 1 does not //seem to work consistently across versions of PHP and Expat ! if (!$this->xmlDoc->preserveWhitespace) { ! $xmlText = eregi_replace('>' . "[[:space:]]+" . '<' , '><', $xmlText); ! } $success = xml_parse($parser, $xmlText); *************** *** 1701,1704 **** --- 1747,1753 ---- $parser->appendEntityTranslationTable($definedEntities); + //not yet implemented in SAXY!!! + $parser->preserveWhitespace = $this->xmlDoc->preserveWhitespace; + $parser->xml_set_element_handler(array(&$this, 'startElement'), array(&$this, 'endElement')); $parser->xml_set_character_data_handler(array(&$this, 'dataElement')); *************** *** 1795,1807 **** break; case ']]>': //cdata remnant - ignore ! $currentNode =& $this->xmlDoc->createCDATASection($this->parseContainer); ! $this->lastChild->appendChild($currentNode); ! $this->inCDATASection = false; ! $this->parseContainer = ''; break; } } } //defaultDataElement ! } //DOMIT_Parser ?> \ No newline at end of file --- 1844,1862 ---- break; case ']]>': //cdata remnant - ignore ! if ($this->preserveCDATA) { ! $currentNode =& $this->xmlDoc->createCDATASection($this->parseContainer); ! $this->lastChild->appendChild($currentNode); ! $this->inCDATASection = false; ! $this->parseContainer = ''; ! } ! else { ! $this->dumpTextNode(); ! } ! break; } } } //defaultDataElement ! } //DOMIT_Lite_Parser ?> \ No newline at end of file Index: xml_saxy_shared.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_saxy_shared.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_saxy_shared.php 28 Jul 2005 13:23:12 -0000 1.1.2.1 --- xml_saxy_shared.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 52,55 **** --- 52,57 ---- /** @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; *************** *** 183,187 **** } ! $attrArray[trim($keyDump)] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; --- 185,190 ---- } ! $keyDump = trim($keyDump); ! $attrArray[$keyDump] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; *************** *** 206,210 **** } ! $attrArray[trim($keyDump)] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; --- 209,214 ---- } ! $keyDump = trim($keyDump); ! $attrArray[$keyDump] = $valueDump; $keyDump = $valueDump = $quoteType = ''; $currentState = SAXY_STATE_ATTR_NONE; Index: xml_domit_shared.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_shared.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_shared.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_shared.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 117,121 **** --- 117,127 ---- } //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 *************** *** 131,143 **** */ function raiseException($errorNum, $errorString) { ! $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 } //DOMIT_DOMException --- 137,162 ---- */ 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 *************** *** 193,195 **** } //DOMIT_DOMImplementation ! ?> --- 212,214 ---- } //DOMIT_DOMImplementation ! ?> \ No newline at end of file Index: xml_domit_include.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_include.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_include.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_include.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 12,14 **** define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_parser.php'); ! ?> --- 12,14 ---- define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_parser.php'); ! ?> \ No newline at end of file Index: changelog.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/changelog.txt,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** changelog.txt 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- changelog.txt 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 184,185 **** --- 184,196 ---- - fixed file i/o bug in DOMIT_Cache + Version 1.0 (2005/08/14) + - many bugfixes + - namespace support fixed and extended + - domit_nodetools.php added with node manipulation tools + - experimental XPath library added + - security fix in testing_domit.php + - DOMIT! Tutorial rewritten in DocBook format + - SAXY updated + + + Index: xml_saxy_parser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_saxy_parser.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_saxy_parser.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_saxy_parser.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 116,121 **** var $defaultNamespaceStack = array(); /** @var array A stack containing tag names of unclosed elements */ ! var $elementNameStack = array(); ! /** --- 116,120 ---- var $defaultNamespaceStack = array(); /** @var array A stack containing tag names of unclosed elements */ ! var $elementNameStack = array(); /** *************** *** 339,343 **** case '-': ! if (($xmlText{($i - 1)} == '-') && ($xmlText{($i - 2)} == '!')) { $this->state = SAXY_STATE_PARSING_COMMENT; $this->charContainer = ''; --- 338,343 ---- case '-': ! if (($xmlText{($i - 1)} == '-') && ($xmlText{($i - 2)} == '!') ! && ($xmlText{($i - 3)} == '<')) { $this->state = SAXY_STATE_PARSING_COMMENT; $this->charContainer = ''; *************** *** 587,591 **** * @param Array The start element attributes */ ! function detectStartNamespaceDeclaration($myAttributes) { $namespaceExists = false; $namespaceMapUpper = 0; --- 587,591 ---- * @param Array The start element attributes */ ! function detectStartNamespaceDeclaration(&$myAttributes) { $namespaceExists = false; $namespaceMapUpper = 0; *************** *** 617,620 **** --- 617,622 ---- $this->fireStartNamespaceDeclarationEvent($prefix, $value); $namespaceExists = true; + + unset($myAttributes[$key]); } } Index: xml_domit_parser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_parser.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_parser.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_parser.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 4,8 **** * @package domit-xmlparser * @subpackage domit-xmlparser-main ! * @version 0.99 * @copyright (C) 2004 John Heinstein. All rights reserved * @license http://www.gnu.org/copyleft/lesser.html LGPL License --- 4,8 ---- * @package domit-xmlparser * @subpackage domit-xmlparser-main ! * @version 1.0 * @copyright (C) 2004 John Heinstein. All rights reserved [...1028 lines suppressed...] ! $this->xmlDoc->xmlDeclaration =& $currentNode; } } //processingInstructionElement *************** *** 3329,3333 **** function startNamespaceDeclaration(&$parser, $prefix, $uri) { //make uri lower case because Expat forces it to upper case for some reason ! $this->namespaceURIMap[strtolower($uri)] = $prefix; } //startNamespaceDeclaration --- 3645,3653 ---- function startNamespaceDeclaration(&$parser, $prefix, $uri) { //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 Index: xml_domit_getelementsbypath.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_getelementsbypath.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_getelementsbypath.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_getelementsbypath.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 162,176 **** switch($this->searchType) { case GET_ELEMENTS_BY_PATH_SEARCH_ABSOLUTE: ! $this->arPathSegments = explode(GET_ELEMENTS_BY_PATH_SEPARATOR, substr($pattern, 1)); break; case GET_ELEMENTS_BY_PATH_SEARCH_RELATIVE: ! $this->arPathSegments = explode(GET_ELEMENTS_BY_PATH_SEPARATOR, substr($pattern, 0)); break; case GET_ELEMENTS_BY_PATH_SEARCH_VARIABLE: ! $this->arPathSegments = explode(GET_ELEMENTS_BY_PATH_SEPARATOR, substr($pattern, 2)); break; } } //splitPattern --- 162,178 ---- switch($this->searchType) { case GET_ELEMENTS_BY_PATH_SEARCH_ABSOLUTE: ! $lastIndex = 1; break; case GET_ELEMENTS_BY_PATH_SEARCH_RELATIVE: ! $lastIndex = 0; break; case GET_ELEMENTS_BY_PATH_SEARCH_VARIABLE: ! $lastIndex = 2; break; } + + $this->arPathSegments = explode(GET_ELEMENTS_BY_PATH_SEPARATOR, substr($pattern, $lastIndex)); } //splitPattern *************** *** 235,239 **** $path = substr($pattern, 0, $beginSquareBrackets); ! $attrPattern = substr($pattern, (strpos($pattern, '@') + 1)); $attrPattern = substr($attrPattern, 0, strpos($attrPattern, ')')); --- 237,241 ---- $path = substr($pattern, 0, $beginSquareBrackets); ! $attrPattern = substr($pattern, (strpos($pattern, '@') + 1)); $attrPattern = substr($attrPattern, 0, strpos($attrPattern, ')')); *************** *** 246,251 **** $myResponse =& $gebp->parsePattern($node, $path); - $total = $myResponse->getLength(); for ($i = 0; $i < $total; $i++) { $currNode =& $myResponse->item($i); --- 248,253 ---- $myResponse =& $gebp->parsePattern($node, $path); $total = $myResponse->getLength(); + for ($i = 0; $i < $total; $i++) { $currNode =& $myResponse->item($i); *************** *** 273,275 **** } //parsePattern } //DOMIT_GetElementsByAttributePath ! ?> --- 275,277 ---- } //parsePattern } //DOMIT_GetElementsByAttributePath ! ?> \ No newline at end of file Index: xml_domit_utilities.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_utilities.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_utilities.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_utilities.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 71,75 **** $result = strtr($result, $definedEntities); return $result; ! } //convertEntities($text) /** --- 71,75 ---- $result = strtr($result, $definedEntities); return $result; ! } //convertEntities /** *************** *** 168,171 **** --- 168,179 ---- if (is_object($node->attributes)) { //DOMIT $response .= $node->attributes->toString(false, $subEntities); + + /* + if ($node->ownerDocument->isNamespaceAware) { + foreach ($node->namespaceURIMap as $key => $value) { + $response .= ' xmlns:' . $value . '="' . $key . '"'; + } + } + */ } else { //DOMIT_Lite *************** *** 369,372 **** } } //fromArray } //DOMIT_Utilities ! ?> --- 377,384 ---- } } //fromArray + + function parseAttributes() { + + } //parseAttributes } //DOMIT_Utilities ! ?> \ No newline at end of file Index: xml_domit_lite_include.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_lite_include.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_lite_include.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_lite_include.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 13,15 **** define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_lite_parser.php'); ! ?> --- 13,15 ---- define('DOMIT_INCLUDE_PATH', (dirname(__FILE__) . "/")); require_once(DOMIT_INCLUDE_PATH . 'xml_domit_lite_parser.php'); ! ?> \ No newline at end of file Index: php_file_utilities.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/php_file_utilities.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** php_file_utilities.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- php_file_utilities.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 9,13 **** * 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') * @return mixed he text or binary data contained in the file */ --- 9,13 ---- * 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 */ *************** *** 41,44 **** --- 41,45 ---- function putDataToFile($fileName, &$data, $writeAttributes) { $fileHandle = @fopen($fileName, $writeAttributes); + if ($fileHandle) { fwrite($fileHandle, $data); Index: xml_domit_doctor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_doctor.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_doctor.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_doctor.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 92,94 **** } //evaluateCharacter } //domit_doctor ! ?> --- 92,94 ---- } //evaluateCharacter } //domit_doctor ! ?> \ No newline at end of file Index: xml_domit_nodemaps.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/other/domit/Attic/xml_domit_nodemaps.php,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** xml_domit_nodemaps.php 28 Jul 2005 13:23:11 -0000 1.1.2.1 --- xml_domit_nodemaps.php 15 Aug 2005 16:09:23 -0000 1.1.2.2 *************** *** 138,141 **** --- 138,160 ---- 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 *************** *** 225,231 **** --- 244,263 ---- $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; *************** *** 357,360 **** --- 389,411 ---- 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 *************** *** 400,402 **** } //DOMIT_NamedNodeMap_Attr ! ?> --- 451,453 ---- } //DOMIT_NamedNodeMap_Attr ! ?> \ No newline at end of file |
From: pkiddie <pk...@us...> - 2005-08-15 16:38:24
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27996/scripts Modified Files: Tag: development_xmlrqp stackDatabase.php stackQuiz.php stackUtility.php stackXML.php Log Message: New revision of DOMIT with better support for namespacing 'Import question' works Preliminary front-end script for importing questions/quizzes and question lists Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5.2.1 retrieving revision 1.5.2.2 diff -C2 -d -r1.5.2.1 -r1.5.2.2 *** stackQuiz.php 10 Aug 2005 08:48:46 -0000 1.5.2.1 --- stackQuiz.php 15 Aug 2005 16:09:23 -0000 1.5.2.2 *************** *** 14,18 **** $stackQuiz['quizid']['descript'] = 'Quiz ID number'; $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; ! //$stackQuiz['quizid']['type'] = 'meta'; <TODO> Why does this duff the quiz edite // 'Quiz name' --- 14,18 ---- $stackQuiz['quizid']['descript'] = 'Quiz ID number'; $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; ! $stackQuiz['quizid']['type'] = 'meta'; // 'Quiz name' Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.13 retrieving revision 1.13.2.14 diff -C2 -d -r1.13.2.13 -r1.13.2.14 *** stackXML.php 12 Aug 2005 17:16:47 -0000 1.13.2.13 --- stackXML.php 15 Aug 2005 16:09:23 -0000 1.13.2.14 *************** *** 50,55 **** //Constants for schema file names, used throughout: creation of schema file names and referencing those schemas in XML files ! define ('questionSchemaName',"stack_question-{$stack_ver['release']}.xsd"); ! define ('quizSchemaName',"stack_quiz-{$stack_ver['release']}.xsd"); /** --- 50,55 ---- //Constants for schema file names, used throughout: creation of schema file names and referencing those schemas in XML files ! define ('questionSchemaName',"stack_question.xsd"); ! define ('quizSchemaName',"stack_quiz.xsd"); /** *************** *** 579,583 **** $xmlDoc = new DOMIT_Document(); ! $quizFrag = new DOMIT_Element('mathQuiz'); return $quListFrag; --- 579,583 ---- $xmlDoc = new DOMIT_Document(); ! $quListFrag = new DOMIT_Element('mathQuiz'); return $quListFrag; *************** *** 743,747 **** * @return string The XML file name */ ! function stack_xml_write_quiz_file($quiz, $directory) { // takes a $stackQuestion array and writes it to an XML file in $directory --- 743,747 ---- * @return string The XML file name */ ! function stack_xml_write_quiz_file_old($quiz, $directory) { // takes a $stackQuestion array and writes it to an XML file in $directory *************** *** 787,790 **** --- 787,792 ---- function stack_xml_parse_question_file($fileName) { + global $stack_root; + $xmlDoc = &new DOMIT_Document(); $xmlDoc->setNamespaceAwareness(true); *************** *** 793,800 **** //In the first instance, check what type of file we are dealing with //Retrieve the document element ! $headElementName = $xmlDoc->documentElement->nodeName; ! switch ($headElementName) ! { case('assessmentItem'): { --- 795,811 ---- //In the first instance, check what type of file we are dealing with //Retrieve the document element ! $headElement = $xmlDoc->documentElement; ! //Now retrieve the version number attached to the XML file being imported, and check for equality ! $importXmlVersion = $headElement->getAttribute('version'); ! $schemaVersion = stack_xml_check_schema_version("{$stack_root}/schemas/"); ! ! if ($importXmlVersion==null) { //Retain for compatibility - use old parsing code ! $question = stack_xml_parse_question_string($xmlDoc->toString); ! } ! ! else if ($importXmlVersion==$schemaVersion) { //Where versions match up ! switch ($headElement->nodeName) ! { case('assessmentItem'): { *************** *** 807,813 **** case('mathQuiz'): { ! //A list of questions $questionList = stack_xml_parse_question_list($xmlDoc); - break; } --- 818,823 ---- case('mathQuiz'): { ! //A list of questions or a quiz? $questionList = stack_xml_parse_question_list($xmlDoc); break; } *************** *** 816,822 **** { //Any other head element ! return null; break; } } } --- 826,838 ---- { //Any other head element ! return false; break; } + } + } + + else { //Where version number of XML data is not the same as the schema + //Throw error + return false; } } *************** *** 855,932 **** } ! function stack_xml_parse_element_into_array(&$element,&$array) ! { ! $noChildren = count($element); ! for ($i = 0; $i < $noChildren; $i++) { ! $node = &$element[$i]; ! //Add this element to the array given, depending on the type of node found ! //Does it have children ! //If so which type? ! //If node has children ! if ($node->childNodes!=null) { ! //We need to check what type these child nodes are.. ! //3==text node - not really a child as such ! if ($node->childNodes[0]->nodeType==3) ! { ! //print_r("Here2"); ! //print_r($node->nodeName); ! $array[$node->nodeName]=$node->getText(); ! } ! ! //1==element - another child, so recurse ! else if ($node->childNodes[0]->nodeType==1); { ! //print_r($node->childNodes[0]->nodeType); ! //print_r("Here"); ! stack_xml_parse_element_into_array($element[$i]->childNodes,$array[$node->nodeName]); } ! } ! ! //If node has not got children ! else ! { ! $array[$node->nodeName]=$node->getText(); } } } - - function stack_xml_parse_question(&$questionXmlDoc) - { - global $namespaces, $stackQuestion; - - $question = array(); - - //1. Retrieve dublin core elements if any exist - //$dcNodeList =&$questionXmlDoc->getElementsByTagNameNS($namespaces['dc']['namespace'],'*'); - - //1. Retrieve dublin core, learning object model and stack core elements if they exist - $elements = &$questionXmlDoc->documentElement->childNodes; - - stack_xml_parse_element_into_array($elements,$question['assessmentItem']); - - show_array($question); - - return $question; - /*// Alle Nodes des Elemnts an array übergeben - - //add ampersand (&) after equal sign for PHP4 compatability - $node =& $elements->item($i); - - //$numChildren = $node->childCount; - - for ($j = 0; $j < $numChildren; $j++) { - ///get reference to current child node - $currChildNode =& $node->childNodes[$j]; - - //echo node value of text node - echo $currChildNode->getText(); - } - } ! foreach ($nodeList as $node) ! { //If node has children if ($node->childNodes!=null) --- 871,938 ---- } ! //This function simply maps from an element in a particular namespace onto the correct stackQuestion/stackQuiz data structure field, ! //and returns that field ! //Probably could be more efficient - multiple passes through array ! function stack_xml_map_element_ns(&$element,$arrayType) ! { ! global $stackQuestion, $stackQuiz; ! //print_r($element->localName); ! ! switch($arrayType) ! { ! case('stackQuestion'): ! { ! foreach($stackQuestion as $arrayKey=>$questionField) ! { ! if((!empty($questionField['type']) && $questionField['type']=='meta')) ! { ! show_array($questionField); ! if ((!empty($questionField['metatag']) && ($questionField['metatag']==$element->localName))) { ! return $arrayKey; ! } ! ! } ! } ! break; ! } ! case('stackQuiz'): { ! foreach($stackQuiz as $arrayKey=>$quizField) { ! if((!empty($stackQuestion['type']) && $stackQuestion['type']=='meta')) ! { ! if ($stackQuestion['metatag']==$element->localName) { ! return $arrayKey; ! } ! ! } } ! break; } } } ! //Recursive function which creates the stackQuestion/stackQuiz data structure required by the parsing engine ! function stack_xml_parse_element_into_array(&$element,&$array,$arrayType) ! { ! $children = &$element->childNodes; //Retrieve all child nodes ! $noChildren = count($children); //Count the number of ! print_r($noChildren); ! ! for ($i = 0; $i < $noChildren; $i++) { ! ! $mapFromNS=false; ! $node = &$children[$i]; ! $nodeName = $node->nodeName; ! ! //Is this node the member of a metadata namespace? If so, map it onto the equivalent question field ! if (!empty($node->namespaceURI)) ! { ! print_r("Gone here!"); ! $nodeName = stack_xml_map_element_ns($node,$arrayType); ! } //We will have a nodeName at this point, whether the actual element or resolved from namespace ! //If node has children if ($node->childNodes!=null) *************** *** 936,977 **** if ($node->childNodes[0]->nodeType==3) { ! print_r($node->nodeName); ! $question[$node->nodeName]=$node->getText(); } ! //1==element - another child else if ($node->childNodes[0]->nodeType==1); ! { ! //Therefore we have an array of data ! $question[$node->nodeName]= array(); ! foreach ($node->childNodes as $child) { ! if ($child->childNodes!=null) ! { ! if ($child->childNodes[0]->nodeType==3) ! { ! $question[$node->nodeName][$child->nodeName]==$child->getText(); ! } ! ! //Must have more elements ! else if ($child->childNodes[0]->nodeType==1) ! { ! $question[$node->nodeName][$cihld->nodeName]==array(); ! } ! ! } ! //Else childnode does not contain data ! else ! { ! $question[$node->nodeName][$child->nodeName]=$child->getText(); ! ! //We need to recurse ! ! ! } --- 942,969 ---- if ($node->childNodes[0]->nodeType==3) { ! $array[$nodeName]=$node->getText(); } ! //1==element - another child, so recurse else if ($node->childNodes[0]->nodeType==1); ! { ! //Check whether there are multiple types of the same node within the XML tree ! $nodeList = &$element->getElementsByTagName("$node->nodeName"); ! $length = $nodeList->getLength(); ! //If there are multiple elements of the same name ! //Deal with arrays of values: for example potential responses and questionVar/answerVar ! if ($length>1) { ! stack_xml_parse_element_into_array($children[$i],$array[$nodeName][],$arrayType); ! } + else + { + stack_xml_parse_element_into_array($children[$i],$array[$nodeName],$arrayType); + } ! } } *************** *** 979,1056 **** else { ! print_r($node->nodeName); ! $question[$ode->nodeName]=$node->getText(); ! } ! } ! ! //Need to use nodeType ! ! //Now iterate through those nodes prepended by the dublin core namespace ! for ($i=0; $i<$dcNodeList->getLength(); $i++) ! { ! $dcNode = &$dcNodeList->item($i); ! //Check against the stackQuestion data structure ! foreach($stackQuestion as $arrayKey=>$questionField) ! { ! $nodeName=explode(":",$dcNode->nodeName); ! ! //print_r($nod ! ! if (!empty($questionField['metatag']) && $questionField['metatag']==$nodeName[1]) ! { ! //show_array($questionField); ! //We know we have found the corresponding stackQuestion tag ! //print_r($dcNode->nodeName); ! //print_r($dcNode->getText()); ! $question[$arrayKey]=$dcNode->getText(); ! break; ! } ! } } ! //2. Retrieve lom elements if any exist ! $lomNodeList = &$questionXmlDoc->getElementsByTagNameNS($namespaces['lom']['namespace'],'*'); ! //Now iterate through those nodes prepended by the dublin core namespace ! for ($i=0; $i<$lomNodeList->getLength(); $i++) ! { ! $lomNode = &$lomNodeList->item($i); ! //Check against the stackQuestion data structure ! foreach($stackQuestion as $arrayKey=>$questionField) ! { ! $nodeName=explode(":",$lomNode->nodeName); ! ! //print_r($nod ! ! if (!empty($questionField['metatag']) && $questionField['metatag']==$nodeName[1]) ! { ! //show_array($questionField); ! //We know we have found the corresponding stackQuestion tag ! //print_r($dcNode->nodeName); ! //print_r($dcNode->getText()); ! $question[$arrayKey]=$lomNode->getText(); ! break; ! } ! ! } ! } show_array($question); - //print_r($retItem->nodeName); - //print_r($retItem->getText()); - //print_r("<br>"); - - //3. Then any other elements who do not have children - //$stackNode - - /*foreach ($questionXmlDoc->documentElement->childNodes as $childElement) - { - //This is not a potential response, options, or types with keyvals - if ($childElement->childNodes==null) - { - switch($childElement->*/ - } --- 971,992 ---- else { ! $array[$nodeName]=$node->getText(); } } + } + + function stack_xml_parse_question(&$questionXmlDoc) + { + global $namespaces, $stackQuestion; + $question = array(); ! $elements = &$questionXmlDoc->documentElement; ! stack_xml_parse_element_into_array($elements,$question['assessmentItem'],'stackQuestion'); + show_array("stack_xml_parse_question"); show_array($question); + return $question; } *************** *** 1120,1153 **** //<PDK> /** ! * Checks the version of the specified schema with the version held in the stackstd.php file * * Loads the question metadata schema and checks the 'version' attribute in stackstd.php for equality. * ! * @param string $questionSchemaLocation The location of the question metadata schema for which this XML file should reflect ! * @return bool $latestVersion True if the schema is the latest version, False otherwise * * <TODO> Depending on logic - can then issue an update to the old schema */ ! function stack_schema_check_version($schemaLocation) { global $stack_ver; $schemaXmlDoc = &new DOMIT_Document(); ! $success = $schemaXmlDoc->loadXML($schemaLocation); if ($success) { //Retrieve the root element - the document element; ! $docElement = &$schemaXmlDoc->$documentElement; $versionAttr = &$docElement->getAttribute('version'); ! if(($versionAttr->nodeValue)==$stack_ver['release']) { ! ! return true; } ! else { return false; } } --- 1056,1101 ---- //<PDK> /** ! * Checks the version of the question and quiz schemas with the version number held in the stackstd.php file * * Loads the question metadata schema and checks the 'version' attribute in stackstd.php for equality. * ! * @param string $questionSchemaLocation The directory to which the question metadata schema resides ! * @return mixed $latestVersion If schema found whose version matches that in stackStd.php, return the version number. Else ! * return false. * * <TODO> Depending on logic - can then issue an update to the old schema */ ! function stack_xml_check_schema_version($schemaDirectory) { global $stack_ver; + $schemaFileName = "{$schemaDirectory}/".questionSchemaName; + $schemaXmlDoc = &new DOMIT_Document(); ! $success = @$schemaXmlDoc->loadXML($schemaFileName); //Hide warning - $success flag takes care of what to do if ($success) { //Retrieve the root element - the document element; ! $docElement = &$schemaXmlDoc->documentElement; $versionAttr = &$docElement->getAttribute('version'); ! if ($versionAttr==null) ! { ! echo("The specified schema $schemaFileName does not have a version tag attached to it. Please contact the developers for support!<br>"); ! return false; } ! else ! { ! //If the schema is the latest version ! if($versionAttr==$stack_ver['release']) { ! return $versionAttr; ! } ! ! else { return false; + } } } *************** *** 1155,1160 **** else { ! echo("The schema file $schemaLocation could not be opened. Please contact the developers!<br>"); } } --- 1103,1153 ---- else { ! echo("The schema file <b>$schemaFileName</b> does not exist. STACK will now recreate all schemas<br>"); ! return false; } + + return false; + } + + /** + * Given that the current version of the schema is outdated, inform the user that STACK is taking steps to update both schemas + * + * Present user with information regarding schema update, and call the necessary schema creation functions + * + * @param string $directory The directory to which the schemas reside + * @return void + * + */ + + function stack_xml_update_schema($directory) + { + global $stack_ver; + + echo "<html> + <head><title>STACK Schema Update</title><head> + <body> + <H1>STACK schemas need updating</H1> + <p><b>This script updates both quiz and question schema to reflect changes in this new version of STACK </b></p>"; + + echo "<b>Updating question schema to version ".$stack_ver['release']."</b><br>"; + + if(stack_xml_create_question_schema($directory)) { + echo ("<font color='green'>Question schema created successfully</font><br>"); + } + + else { + echo ("<font color='red'>Question schema not created successfully</font><br>"); + } + + echo "<b>Updating quiz schema to version ".$stack_ver['release']."</b><br>"; + + if(stack_xml_create_quiz_schema($directory)) { + echo ("<font color='green'>Quiz schema created successfully</font><br>"); + } + + else { + echo ("<font color='red'>Quiz schema not created successfully</font><br>"); + } + } *************** *** 2317,2321 **** } ! //stack_xml_create_question_schema(); ! //stack_xml_create_quiz_schema(); ?> --- 2310,2316 ---- } ! if (!stack_xml_check_schema_version("{$stack_root}/schemas/")) ! { ! stack_xml_update_schema("{$stack_root}/schemas/"); ! } ?> Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.30.2.2 retrieving revision 1.30.2.3 diff -C2 -d -r1.30.2.2 -r1.30.2.3 *** stackUtility.php 28 Jul 2005 13:36:23 -0000 1.30.2.2 --- stackUtility.php 15 Aug 2005 16:09:23 -0000 1.30.2.3 *************** *** 16,19 **** --- 16,20 ---- // (1) remove stackData.php - and its reference in stackstd.php // (2) remove stackSocketSend.php - and its reference in stackstd.php + // (3) Remove versioning from stackStd and put somewhere else. if ($stack_stand_alone) { require_once("{$stack_root}/scripts/moodlelib.php"); *************** *** 1071,1075 **** else { ! return false; } } ?> --- 1072,1077 ---- else { ! return false; ! } } ?> Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.34.2.2 retrieving revision 1.34.2.3 diff -C2 -d -r1.34.2.2 -r1.34.2.3 *** stackDatabase.php 12 Aug 2005 17:16:47 -0000 1.34.2.2 --- stackDatabase.php 15 Aug 2005 16:09:23 -0000 1.34.2.3 *************** *** 1122,1128 **** $question['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! show_array("db:"); ! show_array($question); ! show_array($user); } --- 1122,1128 ---- $question['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! //show_array("db:"); ! //show_array($question); ! //show_array($user); } |
From: pkiddie <pk...@us...> - 2005-08-15 16:38:23
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27996 Modified Files: Tag: development_xmlrqp changelog.txt editquiz.php Added Files: Tag: development_xmlrqp import.php Log Message: New revision of DOMIT with better support for namespacing 'Import question' works Preliminary front-end script for importing questions/quizzes and question lists Index: changelog.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/changelog.txt,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -C2 -d -r1.1.2.6 -r1.1.2.7 *** changelog.txt 12 Aug 2005 17:16:46 -0000 1.1.2.6 --- changelog.txt 15 Aug 2005 16:09:23 -0000 1.1.2.7 *************** *** 25,36 **** - Some documentation additions. - Rather than STACK not correctly installed, how about showing the installation documentation - use of index.php for this, check ! for the presence of a completed installatio ! ! - Schema creation - this is created upon first installation, and where the STACK version changes in any way, this metadata is recreated ! - Exporting of questions, quizzes, and question lists ! questionUserLastUpdated field, what should it contain ! ! Each potential response now has a order element, as order is crucial. ! Question variable keyval types are encompassed within a <questionVar> XML declaration Known issues: --- 25,36 ---- - Some documentation additions. - Rather than STACK not correctly installed, how about showing the installation documentation - use of index.php for this, check ! for the presence of a completed installatio ! ! - Schema creation - this is created upon first installation, and where the STACK version changes in any way, this metadata is recreated ! - Exporting of questions, quizzes, and question lists ! questionUserLastUpdated field, what should it contain ! ! Each potential response now has a order element, as order is crucial. ! Question variable keyval types are encompassed within a <questionVar> XML declaration Known issues: *************** *** 41,50 **** - In the potential response schema structure, the possible enumerations for RawMarkMod and AnsTest are not output. This is a known issue and is due to the $markmods array which holds the possible values being present in stackAuthor - not ! stackQuestion as expected. 12/08/2005 AnsTest values to be written out in schema. ! - Currently all metadata fields are written out - but are written default instead of what their default values are. This needs to be rectified ! - Ability to export a quiz with no questions attached ! - Adding a 'type' to quizID breaks the quiz export functionality ! - Really after exporting, the download file should be appended with the quiz listing ! - Quiz needs 'import' button - Head elements in schema do not have a minOcurrs and maxOccurs attributes - fails validation 12/08/2005 --- 41,53 ---- - In the potential response schema structure, the possible enumerations for RawMarkMod and AnsTest are not output. This is a known issue and is due to the $markmods array which holds the possible values being present in stackAuthor - not ! stackQuestion as expected. 12/08/2005 AnsTest values to be written out in schema. ! - Currently all metadata fields are written out - but are written default instead of what their default values are. This needs to be rectified ! ! - Where to put version checking routine - ask Chris - initialisation? - on importing questions check against version - old XML questions will not have a version attached ! - Ability to export a quiz with no questions attached - should I block this? NO ! - Adding a 'type' to quizID breaks the quiz export functionality - Chris fine ! - Really after exporting, the download file should be appended with the quiz listing - how? - DONE ! - Quiz needs 'import' button - Chris - DONE ! - Where does a new question get assigned a GUID? - in stackDatabase.php - Head elements in schema do not have a minOcurrs and maxOccurs attributes - fails validation 12/08/2005 *************** *** 63,68 **** Todo: - Exporting an individual question, a list of questions and a quiz - DONE (10/08/2005) ! - Importing an individual question, a list of questions and a quiz ! - Version checking - RQP faults encapsulated within SOAP specific faults. - Remove minOcurrs and maxOcurrs on root 'type' nodes --- 66,72 ---- Todo: - Exporting an individual question, a list of questions and a quiz - DONE (10/08/2005) ! - Importing an individual question, a list of questions and a quiz ! - Version checking - DONE 15/08/2005 ! - Declarenamespace using DOMIT v1 - RQP faults encapsulated within SOAP specific faults. - Remove minOcurrs and maxOcurrs on root 'type' nodes --- NEW FILE: import.php --- <?php /** 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 */ session_start(); require_once("other/ListMenu.php"); require_once("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"); /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, $user and $username /////////////////////////////////////////////////////////////// $default_action = 'import'; include('frontend_general/process_input.php'); //include_once('frontend_general/edit_quiz_util.php'); $PostTo = 'import.php'; $filter = ''; $quizid = NULL; include('html/pagehead.php'); if (!stack_user_is_admin($user) or !stack_is_logged_in($user)) { stack_display_editquiz_error_not_admin($user); include('html/pagefoot.php'); die(); } if ($action=='import') { stack_display_qb_import($errors); } /** * 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_addquestion($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>"; } ?> Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.13.2.1 retrieving revision 1.13.2.2 diff -C2 -d -r1.13.2.1 -r1.13.2.2 *** editquiz.php 10 Aug 2005 08:48:45 -0000 1.13.2.1 --- editquiz.php 15 Aug 2005 16:09:23 -0000 1.13.2.2 *************** *** 142,145 **** --- 142,150 ---- if ('quiz_new' == $action) { $quiz['quizid'] = $quizid; + //<TODO> Automatically generated quiz metadata + $quiz['questionFormat'] = 'text/xml; charset="utf-8"'; + $quiz['questionPublisher'] = $stack_web_url; + $quiz['type'] = 'quiz'; + $quiz['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; $action = 'quiz_edit'; } *************** *** 160,168 **** switch ($action) { case 'quiz_choose': $quiz_store = stack_db_quiz_get(); stack_display_editquiz_select($quiz_store, $PostTo); break; ! case 'quiz_edit': stack_display_editquiz_edit($quiz,$errors,$PostTo); break; --- 165,180 ---- switch ($action) { + case 'quiz_xml': + { + echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; + } case 'quiz_choose': $quiz_store = stack_db_quiz_get(); stack_display_editquiz_select($quiz_store, $PostTo); break; ! case 'import': ! { ! } ! case 'quiz_edit': stack_display_editquiz_edit($quiz,$errors,$PostTo); break; *************** *** 170,183 **** stack_db_listquestions_quiz($question_bank_filter,$quizid); break; - case 'quiz_xml': - { - echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; - $action = 'quizbank_screen'; - } - } - - switch ($action) { - case 'quizbank_screen': - echo"<br>The main quiz screen should be shown here<br>"; } --- 182,185 ---- |
Update of /cvsroot/stack/stack-1-0/other/domit/documentation In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27996/other/domit/documentation Removed Files: Tag: development_xmlrqp DOMIT.html DOMIT_Attr.html DOMIT_CDATASection.html DOMIT_Cache.html DOMIT_CharacterData.html DOMIT_ChildNodes_Interface.html DOMIT_Comment.html DOMIT_DOMException.html DOMIT_DOMImplementation.html DOMIT_Doctor.html DOMIT_Document.html DOMIT_DocumentFragment.html DOMIT_DocumentType.html DOMIT_Element.html DOMIT_GetElementsByPath.html DOMIT_GetElementsByTagName.html DOMIT_NamedNodeMap.html DOMIT_NamedNodeMap_Attr.html DOMIT_Node.html DOMIT_NodeList.html DOMIT_Parser.html DOMIT_ProcessingInstruction.html DOMIT_TextNode.html DOMIT_Utilities.html DOMIT_tutorial_000.html DOMIT_tutorial_001.html DOMIT_tutorial_002.html DOMIT_tutorial_003.html DOMIT_tutorial_004.html DOMIT_tutorial_005.html DOMIT_tutorial_006.html DOMIT_tutorial_007.html DOMIT_tutorial_008.html DOMIT_tutorial_009.html DOMIT_tutorial_010.html DOMIT_tutorial_011.html DOMIT_tutorial_012.html DOMIT_tutorial_013.html DOMIT_tutorial_014.html DOMIT_tutorial_015.html DOMIT_tutorial_016.html DOMIT_tutorial_017.html DOMIT_tutorial_018.html DOMIT_tutorial_019.html DOMIT_tutorial_020.html DOMIT_tutorial_021.html DOMIT_tutorial_022.html DOMIT_tutorial_023.html DOMIT_tutorial_024.html DOMIT_tutorial_025.html DOMIT_tutorial_026.html DOMIT_tutorial_027.html DOMIT_tutorial_028.html DOMIT_tutorial_029.html DOMIT_tutorial_030.html DOMIT_tutorial_031.html DOMIT_tutorial_032.html DOMIT_tutorial_033.html DOMIT_tutorial_034.html DOMIT_tutorial_035.html DOMIT_tutorial_036.html DOMIT_tutorial_037.html DOMIT_tutorial_038.html UIDGenerator.html classy_builder.html classy_builder.swf docstyles.css functions.js license.txt menu.html menu_tutorial.html package_DOMIT.html package_SAXY.html Log Message: New revision of DOMIT with better support for namespacing 'Import question' works Preliminary front-end script for importing questions/quizzes and question lists --- DOMIT_Comment.html DELETED --- --- menu_tutorial.html DELETED --- --- DOMIT_NamedNodeMap_Attr.html DELETED --- --- DOMIT_TextNode.html DELETED --- --- classy_builder.swf DELETED --- --- DOMIT_tutorial_031.html DELETED --- --- DOMIT_tutorial_003.html DELETED --- --- functions.js DELETED --- --- DOMIT_GetElementsByTagName.html DELETED --- --- DOMIT_Element.html DELETED --- --- DOMIT_DocumentType.html DELETED --- --- DOMIT_tutorial_005.html DELETED --- --- DOMIT_tutorial_033.html DELETED --- --- DOMIT_tutorial_017.html DELETED --- --- DOMIT_tutorial_008.html DELETED --- --- DOMIT_GetElementsByPath.html DELETED --- --- DOMIT_Parser.html DELETED --- --- DOMIT_tutorial_027.html DELETED --- --- DOMIT_NamedNodeMap.html DELETED --- --- DOMIT_tutorial_000.html DELETED --- --- DOMIT_tutorial_001.html DELETED --- --- UIDGenerator.html DELETED --- --- DOMIT_DOMImplementation.html DELETED --- --- DOMIT_Node.html DELETED --- --- DOMIT_tutorial_014.html DELETED --- --- DOMIT_tutorial_030.html DELETED --- --- DOMIT_tutorial_024.html DELETED --- --- DOMIT_tutorial_026.html DELETED --- --- DOMIT_tutorial_002.html DELETED --- --- DOMIT_DOMException.html DELETED --- --- DOMIT_tutorial_006.html DELETED --- --- DOMIT_tutorial_032.html DELETED --- --- DOMIT_Doctor.html DELETED --- --- DOMIT_tutorial_036.html DELETED --- --- package_DOMIT.html DELETED --- --- docstyles.css DELETED --- --- DOMIT_DocumentFragment.html DELETED --- --- DOMIT_tutorial_029.html DELETED --- --- DOMIT_tutorial_010.html DELETED --- --- DOMIT_Attr.html DELETED --- --- DOMIT_tutorial_038.html DELETED --- --- DOMIT_Cache.html DELETED --- --- DOMIT_tutorial_022.html DELETED --- --- DOMIT.html DELETED --- --- DOMIT_NodeList.html DELETED --- --- DOMIT_tutorial_007.html DELETED --- --- DOMIT_Document.html DELETED --- --- DOMIT_tutorial_012.html DELETED --- --- DOMIT_tutorial_016.html DELETED --- --- DOMIT_ProcessingInstruction.html DELETED --- --- DOMIT_tutorial_020.html DELETED --- --- DOMIT_tutorial_011.html DELETED --- --- DOMIT_tutorial_034.html DELETED --- --- DOMIT_tutorial_028.html DELETED --- --- DOMIT_tutorial_015.html DELETED --- --- DOMIT_tutorial_013.html DELETED --- --- DOMIT_tutorial_023.html DELETED --- --- DOMIT_tutorial_037.html DELETED --- --- DOMIT_CharacterData.html DELETED --- --- DOMIT_tutorial_035.html DELETED --- --- DOMIT_Utilities.html DELETED --- --- DOMIT_tutorial_018.html DELETED --- --- DOMIT_ChildNodes_Interface.html DELETED --- --- DOMIT_tutorial_019.html DELETED --- --- package_SAXY.html DELETED --- --- DOMIT_tutorial_004.html DELETED --- --- DOMIT_tutorial_021.html DELETED --- --- DOMIT_tutorial_009.html DELETED --- --- DOMIT_tutorial_025.html DELETED --- --- menu.html DELETED --- --- license.txt DELETED --- --- classy_builder.html DELETED --- --- DOMIT_CDATASection.html DELETED --- |
From: pkiddie <pk...@us...> - 2005-08-12 17:16:59
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16159/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackDatabase.php stackQuestion.php stackXML.php Log Message: default language in 'stackQuestion' taken from respective field in stackstd hidden question metadata fields populated in stackDatabase $stackUserLastEdited added to hidden metadata Schemas recreated to reflect changes noted in changelog Recursive function responsible for reading in XML file into array Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.34.2.1 retrieving revision 1.34.2.2 diff -C2 -d -r1.34.2.1 -r1.34.2.2 *** stackDatabase.php 1 Aug 2005 21:56:33 -0000 1.34.2.1 --- stackDatabase.php 12 Aug 2005 17:16:47 -0000 1.34.2.2 *************** *** 1041,1047 **** // Otherwise we store it as a new question. ! global $stackQuestion,$stack_web_url; ! ! // Take the first 30 chars from the question stem --- 1041,1045 ---- // Otherwise we store it as a new question. ! global $stackQuestion,$stack_web_url, $user; // Take the first 30 chars from the question stem *************** *** 1113,1120 **** // New questions get a new GUID. if ($newq) { ! $questionGUID = stack_generate_guid($stack_web_url); ! } --- 1111,1128 ---- // New questions get a new GUID. + //<PDK> new questions also get tagged with a creator, an URL representing the publisher, the type 'question', and format... hidden tags + // if ($newq) { ! $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']; ! ! show_array("db:"); ! show_array($question); ! show_array($user); } *************** *** 1143,1146 **** --- 1151,1155 ---- if (array_key_exists($qfield,$question)) { + $qu_meta[$qfield]=$question[$qfield]; *************** *** 1175,1178 **** --- 1184,1189 ---- foreach( $qu_meta as $qfield => $val){ + // print_r($qfield); + $qu_fields .= ','.$qfield; *************** *** 1253,1256 **** --- 1264,1269 ---- //echo $query; + //print_r($query); + $result= stack_db_query($query); Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.12 retrieving revision 1.13.2.13 diff -C2 -d -r1.13.2.12 -r1.13.2.13 *** stackXML.php 12 Aug 2005 13:51:54 -0000 1.13.2.12 --- stackXML.php 12 Aug 2005 17:16:47 -0000 1.13.2.13 *************** *** 184,190 **** { //Iterate through those reponses ! foreach ($question[$qfield] as $potResp) { $potRespElem = &$xmlDoc->createElementNS('',$qfield); //Create a potential response element //Iterate through fields of a potential response foreach ($potResp as $potRespKey => $potRespField) --- 184,196 ---- { //Iterate through those reponses ! foreach ($question[$qfield] as $order =>$potResp) { $potRespElem = &$xmlDoc->createElementNS('',$qfield); //Create a potential response element + //Order of potential reponses is important. + //Thus create an 'order' element and append to potential response head + $potRespOrder = &$xmlDoc->createElementNS('','order'); + $potRespOrder->setText($order); + $potRespElem->appendChild($potRespOrder); + //Iterate through fields of a potential response foreach ($potResp as $potRespKey => $potRespField) *************** *** 239,252 **** //3. All other elements - question paramaters and key val types else if (array_key_exists($qfield,$question)) { - - //Write head element - $questionElement = &$xmlDoc->createElementNS('',$qfield); if (is_array($question[$qfield])) { //Is it of type keyval? if ($attribs['type']=='keyval') { foreach ($question[$qfield] as $keyvalType) { $keyElement = &$xmlDoc->createElementNS('',"key"); $keyElement->setText($keyvalType['key']); --- 245,259 ---- //3. All other elements - question paramaters and key val types else if (array_key_exists($qfield,$question)) { if (is_array($question[$qfield])) { //Is it of type keyval? + //If so for each variable we must create a container: i.e. x*<questionVars> if ($attribs['type']=='keyval') { foreach ($question[$qfield] as $keyvalType) { + + $questionElement = &$xmlDoc->createElementNS('',$qfield); + $keyElement = &$xmlDoc->createElementNS('',"key"); $keyElement->setText($keyvalType['key']); *************** *** 256,260 **** $questionElement->appendChild($keyElement); ! $questionElement->appendChild($valElement); } } --- 263,271 ---- $questionElement->appendChild($keyElement); ! $questionElement->appendChild($valElement); ! ! //Then append this type onto question fragment ! $questionFrag->appendChild($questionElement); ! } } *************** *** 263,270 **** else { //Just a simple type - string etc, so just append the text to the node $questionElement->setText($question[$qfield]); } - $questionFrag->appendChild($questionElement); } --- 274,283 ---- else { + //Write head element + $questionElement = &$xmlDoc->createElementNS('',$qfield); //Just a simple type - string etc, so just append the text to the node $questionElement->setText($question[$qfield]); + $questionFrag->appendChild($questionElement); } } *************** *** 699,703 **** // if question is named, uses the questionName as the filename ! // otherwise use questionID if ($question['questionName'] != '') { $xml_file_name = $question['questionName'].".xml"; --- 712,716 ---- // if question is named, uses the questionName as the filename ! // otherwise us e questionID if ($question['questionName'] != '') { $xml_file_name = $question['questionName'].".xml"; *************** *** 788,791 **** --- 801,805 ---- //A single question $question = stack_xml_parse_question($xmlDoc); + return $question; break; } *************** *** 842,846 **** function stack_xml_parse_element_into_array(&$element,&$array) ! { $noChildren = count($element); --- 856,860 ---- function stack_xml_parse_element_into_array(&$element,&$array) ! { $noChildren = count($element); *************** *** 848,853 **** $node = &$element[$i]; - print_r($node->nodeName); - //Add this element to the array given, depending on the type of node found //Does it have children --- 862,865 ---- *************** *** 860,863 **** --- 872,876 ---- if ($node->childNodes[0]->nodeType==3) { + //print_r("Here2"); //print_r($node->nodeName); $array[$node->nodeName]=$node->getText(); *************** *** 867,872 **** else if ($node->childNodes[0]->nodeType==1); { ! print_r("Here"); ! stack_xml_parse_element_into_array($element[$node->nodeName],$array); } } --- 880,886 ---- else if ($node->childNodes[0]->nodeType==1); { ! //print_r($node->childNodes[0]->nodeType); ! //print_r("Here"); ! stack_xml_parse_element_into_array($element[$i]->childNodes,$array[$node->nodeName]); } } *************** *** 892,898 **** $elements = &$questionXmlDoc->documentElement->childNodes; ! stack_xml_parse_element_into_array($elements,$question); show_array($question); /*// Alle Nodes des Elemnts an array übergeben --- 906,914 ---- $elements = &$questionXmlDoc->documentElement->childNodes; ! stack_xml_parse_element_into_array($elements,$question['assessmentItem']); show_array($question); + + return $question; /*// Alle Nodes des Elemnts an array übergeben *************** *** 1314,1321 **** unset($stackQuestion['questionID']); } - - /*$dom = new DOMIT_Document(); - - $dom->appendChild($dom->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); */ //Contruct the schema root --- 1330,1333 ---- *************** *** 1350,1354 **** foreach($types as $arrayKey=>$type) { ! $schemaElement = &stack_xml_create_schema_field($type,FALSE,''); $schemaComplexType = &new DOMIT_Element('xs:complexType'); --- 1362,1366 ---- foreach($types as $arrayKey=>$type) { ! $schemaElement = &stack_xml_create_root_schema_field($type,FALSE,''); $schemaComplexType = &new DOMIT_Element('xs:complexType'); *************** *** 1442,1446 **** //Now we must iterate through stackQuestion again, this time picking out the non-metadata terms - //question, options, and potential responses. ! $schemaElement = &stack_xml_create_schema_field('question',FALSE,''); $xmlElements[] = 'question'; --- 1454,1458 ---- //Now we must iterate through stackQuestion again, this time picking out the non-metadata terms - //question, options, and potential responses. ! $schemaElement = &stack_xml_create_root_schema_field('question',FALSE,''); $xmlElements[] = 'question'; *************** *** 1551,1555 **** //3.1 Now output 'other' types //3.1.1 Option type ! $schemaElement = &stack_xml_create_schema_field('questionOptions',FALSE,''); $xmlElements[] = 'questionOptions'; --- 1563,1567 ---- //3.1 Now output 'other' types //3.1.1 Option type ! $schemaElement = &stack_xml_create_root_schema_field('questionOptions',FALSE,''); $xmlElements[] = 'questionOptions'; *************** *** 1648,1654 **** //3.1.2 Potential reponses type ! $schemaElement = &stack_xml_create_schema_field('questionPotResp',FALSE,'',0,'unbounded'); $xmlElements[] = 'questionPotResp'; ! $schemaComplexType = &new DOMIT_Element('xs:complexType'); $schemaSequence = &new DOMIT_Element('xs:sequence'); --- 1660,1670 ---- //3.1.2 Potential reponses type ! $schemaElement = &stack_xml_create_root_schema_field('questionPotResp',FALSE,'',0,'unbounded'); $xmlElements[] = 'questionPotResp'; ! ! //3.1.3 Each potential response has an order field ! $orderElement = &stack_xml_create_schema_field('order',FALSE,'',1,1); ! $orderElement->appendChild($schemaElement); ! $schemaComplexType = &new DOMIT_Element('xs:complexType'); $schemaSequence = &new DOMIT_Element('xs:sequence'); *************** *** 2060,2065 **** } ! //Creates an XML field which is returned to the main body, which contains an element and the number of times that field may appear ! //in the XML document - defaulted to a minimum of 0 and maximum of 1, but the user can specify /** --- 2076,2133 ---- } ! /** ! * Creates a root schema element which has not been defined in an external namespace. These fields cannot have a minimum and maximum occurrence ! * ! * @see stack_xml_create_question_schema() ! * @param string $name The name of the field to write out ! * @param bool $isSqlType Whether the defined type is a SQL data type and must be mapped its respective schema type ! * @param string $dataType The type of element. Default to SQL data type: 'TEXT' which is mapped onto default schema type xs:string ! * @param int $minOccurs The minimum number of times this element must occur in an XML instance of this schema. Default: 0 - doesnt have to occur ! * @param int $maxOccurs The maximum number of times this element must occur in an XML instance of this schema. Defualt: 1 - must not ocurr more than once ! * @return DOMIT_Element $schemaField The schema field. ! */ ! function stack_xml_create_root_schema_field($name, $isSqlType, $dataType='TEXT', $minOccurs=0,$maxOccurs=1) ! { ! global $sqlToSchemaMapping; //Mapping array required for conversion of SQL->Schema datatype ! ! $schemaField = &new DOMIT_Element('xs:element'); ! $schemaFieldAttr = &new DOMIT_Attr('name'); ! $schemaFieldAttr->nodeValue=$name; ! ! //Add attributes to element ! $schemaField->setAttributeNode($schemaFieldAttr); ! ! //Since we are not referencing known metadata from a namespace we need to define the type of data that is being represented ! $schemaTypeAttr = &new DOMIT_Attr('type'); ! ! //If $dataType is a SQL data type - use mapping array to convert to respective schema data type ! if ($isSqlType) ! { ! //1. Ensure element type is upper case to ensure comparison array (SQL->XML type) will work. ! $dataType = strtoupper($dataType); ! ! //2. Now we are only interested in the first word of the SQL datatype in order to convert to XML datatype, hence explode ! //Make sensitive to white space ! $elementDataType = explode(" ", $dataType); ! ! //3. But we also can have SQL datatypes which give array length - CHAR(22) for example - we are not interested in this ! //Make sensitive to open bracket ! $elementDataType = explode("(", $elementDataType[0]); ! ! //4. Now map SQL->XML schema datatype ! $schemaTypeAttr->nodeValue='xs:'.$sqlToSchemaMapping[$elementDataType[0]]; ! $schemaField->setAttributeNode($schemaTypeAttr); ! } ! ! //If $dataType is not a SQL data type - do not map. ! else if (!$isSqlType && $dataType!='') ! { ! $schemaTypeAttr->nodeValue=$dataType; ! $schemaField->setAttributeNode($schemaTypeAttr); ! } ! ! //Return an xml element which can simply be appended ! return $schemaField; ! } /** Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.2 retrieving revision 1.29.2.3 diff -C2 -d -r1.29.2.2 -r1.29.2.3 *** stackAuthor.php 10 Aug 2005 08:48:46 -0000 1.29.2.2 --- stackAuthor.php 12 Aug 2005 17:16:47 -0000 1.29.2.3 *************** *** 169,173 **** } - // Add all the metadata to the question. // <PDK> Added hidden metadata here --- 169,172 ---- *************** *** 176,179 **** --- 175,179 ---- <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='questionType' value='".sf($question,'questionType')."' />\n Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.30.2.4 retrieving revision 1.30.2.5 diff -C2 -d -r1.30.2.4 -r1.30.2.5 *** stackQuestion.php 3 Aug 2005 13:55:24 -0000 1.30.2.4 --- stackQuestion.php 12 Aug 2005 17:16:47 -0000 1.30.2.5 *************** *** 562,566 **** $stackQuestion['questionLanguage']['metatype']='dublincore'; ! $stackQuestion['questionLanguage']['default']='unspecified'; --- 562,568 ---- $stackQuestion['questionLanguage']['metatype']='dublincore'; ! $stackQuestion['questionLanguage']['default']=//'unspecified'; ! ! $stackQuestion['questionLanguage']['default']=$stack_defaultlang; |
From: pkiddie <pk...@us...> - 2005-08-12 17:16:59
|
Update of /cvsroot/stack/stack-1-0/schemas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16159/schemas Modified Files: Tag: development_xmlrqp stack_question-1.0.xsd stack_quiz-1.0.xsd Log Message: default language in 'stackQuestion' taken from respective field in stackstd hidden question metadata fields populated in stackDatabase $stackUserLastEdited added to hidden metadata Schemas recreated to reflect changes noted in changelog Recursive function responsible for reading in XML file into array Index: stack_quiz-1.0.xsd =================================================================== RCS file: /cvsroot/stack/stack-1-0/schemas/Attic/stack_quiz-1.0.xsd,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** stack_quiz-1.0.xsd 8 Aug 2005 22:10:25 -0000 1.1.2.1 --- stack_quiz-1.0.xsd 12 Aug 2005 17:16:46 -0000 1.1.2.2 *************** *** 3,7 **** <xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd" /> <xs:import namespace="http://www.imsglobal.org/xsd/imsmd_v1p2" schemaLocation="imsmd_v1p2.xsd" /> ! <xs:element name="dublincore" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 3,7 ---- <xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd" /> <xs:import namespace="http://www.imsglobal.org/xsd/imsmd_v1p2" schemaLocation="imsmd_v1p2.xsd" /> ! <xs:element name="dublincore"> <xs:complexType> <xs:sequence> *************** *** 59,63 **** </xs:complexType> </xs:element> ! <xs:element name="lom" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 59,63 ---- </xs:complexType> </xs:element> ! <xs:element name="lom"> <xs:complexType> <xs:sequence> *************** *** 85,89 **** </xs:complexType> </xs:element> ! <xs:element name="stack" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 85,89 ---- </xs:complexType> </xs:element> ! <xs:element name="stack"> <xs:complexType> <xs:sequence> *************** *** 106,110 **** </xs:complexType> </xs:element> ! <xs:element name="question" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 106,110 ---- </xs:complexType> </xs:element> ! <xs:element name="question"> <xs:complexType> <xs:sequence> *************** *** 280,284 **** </xs:restriction> </xs:simpleType> ! <xs:element name="questionOptions" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 280,284 ---- </xs:restriction> </xs:simpleType> ! <xs:element name="questionOptions"> <xs:complexType> <xs:sequence> *************** *** 457,461 **** </xs:restriction> </xs:simpleType> ! <xs:element name="questionPotResp" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> --- 457,461 ---- </xs:restriction> </xs:simpleType> ! <xs:element name="questionPotResp"> <xs:complexType> <xs:sequence> Index: stack_question-1.0.xsd =================================================================== RCS file: /cvsroot/stack/stack-1-0/schemas/Attic/stack_question-1.0.xsd,v retrieving revision 1.1.2.1 retrieving revision 1.1.2.2 diff -C2 -d -r1.1.2.1 -r1.1.2.2 *** stack_question-1.0.xsd 8 Aug 2005 22:10:25 -0000 1.1.2.1 --- stack_question-1.0.xsd 12 Aug 2005 17:16:46 -0000 1.1.2.2 *************** *** 3,7 **** <xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd" /> <xs:import namespace="http://www.imsglobal.org/xsd/imsmd_v1p2" schemaLocation="imsmd_v1p2.xsd" /> ! <xs:element name="dublincore" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 3,7 ---- <xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd" /> <xs:import namespace="http://www.imsglobal.org/xsd/imsmd_v1p2" schemaLocation="imsmd_v1p2.xsd" /> ! <xs:element name="dublincore"> <xs:complexType> <xs:sequence> *************** *** 59,63 **** </xs:complexType> </xs:element> ! <xs:element name="lom" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 59,63 ---- </xs:complexType> </xs:element> ! <xs:element name="lom"> <xs:complexType> <xs:sequence> *************** *** 85,89 **** </xs:complexType> </xs:element> ! <xs:element name="stack" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 85,89 ---- </xs:complexType> </xs:element> ! <xs:element name="stack"> <xs:complexType> <xs:sequence> *************** *** 106,110 **** </xs:complexType> </xs:element> ! <xs:element name="question" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 106,110 ---- </xs:complexType> </xs:element> ! <xs:element name="question"> <xs:complexType> <xs:sequence> *************** *** 280,284 **** </xs:restriction> </xs:simpleType> ! <xs:element name="questionOptions" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> --- 280,284 ---- </xs:restriction> </xs:simpleType> ! <xs:element name="questionOptions"> <xs:complexType> <xs:sequence> *************** *** 457,461 **** </xs:restriction> </xs:simpleType> ! <xs:element name="questionPotResp" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> --- 457,461 ---- </xs:restriction> </xs:simpleType> ! <xs:element name="questionPotResp"> <xs:complexType> <xs:sequence> |
From: pkiddie <pk...@us...> - 2005-08-12 17:16:54
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16159 Modified Files: Tag: development_xmlrqp changelog.txt Log Message: default language in 'stackQuestion' taken from respective field in stackstd hidden question metadata fields populated in stackDatabase $stackUserLastEdited added to hidden metadata Schemas recreated to reflect changes noted in changelog Recursive function responsible for reading in XML file into array Index: changelog.txt =================================================================== RCS file: /cvsroot/stack/stack-1-0/Attic/changelog.txt,v retrieving revision 1.1.2.5 retrieving revision 1.1.2.6 diff -C2 -d -r1.1.2.5 -r1.1.2.6 *** changelog.txt 4 Aug 2005 12:09:42 -0000 1.1.2.5 --- changelog.txt 12 Aug 2005 17:16:46 -0000 1.1.2.6 *************** *** 25,29 **** - Some documentation additions. - Rather than STACK not correctly installed, how about showing the installation documentation - use of index.php for this, check ! for the presence of a completed installatio Known issues: --- 25,36 ---- - Some documentation additions. - Rather than STACK not correctly installed, how about showing the installation documentation - use of index.php for this, check ! for the presence of a completed installatio ! ! - Schema creation - this is created upon first installation, and where the STACK version changes in any way, this metadata is recreated ! - Exporting of questions, quizzes, and question lists ! questionUserLastUpdated field, what should it contain ! ! Each potential response now has a order element, as order is crucial. ! Question variable keyval types are encompassed within a <questionVar> XML declaration Known issues: *************** *** 34,39 **** - In the potential response schema structure, the possible enumerations for RawMarkMod and AnsTest are not output. This is a known issue and is due to the $markmods array which holds the possible values being present in stackAuthor - not ! stackQuestion as expected. ! - AnsTest values to be written out in schema. Issues when running STACK with IIS instead of Apache: --- 41,51 ---- - In the potential response schema structure, the possible enumerations for RawMarkMod and AnsTest are not output. This is a known issue and is due to the $markmods array which holds the possible values being present in stackAuthor - not ! stackQuestion as expected. 12/08/2005 AnsTest values to be written out in schema. ! - Currently all metadata fields are written out - but are written default instead of what their default values are. This needs to be rectified ! - Ability to export a quiz with no questions attached ! - Adding a 'type' to quizID breaks the quiz export functionality ! - Really after exporting, the download file should be appended with the quiz listing ! - Quiz needs 'import' button ! - Head elements in schema do not have a minOcurrs and maxOccurs attributes - fails validation 12/08/2005 Issues when running STACK with IIS instead of Apache: *************** *** 50,56 **** Todo: ! - Exporting an individual question, a list of questions and a quiz ! - Importing an individual question, a list of questions and a quiz ! - Import tag needs to go on quiz UI - RQP faults encapsulated within SOAP specific faults. - Remove minOcurrs and maxOcurrs on root 'type' nodes --- 62,68 ---- Todo: ! - Exporting an individual question, a list of questions and a quiz - DONE (10/08/2005) ! - Importing an individual question, a list of questions and a quiz ! - Version checking - RQP faults encapsulated within SOAP specific faults. - Remove minOcurrs and maxOcurrs on root 'type' nodes |
From: pkiddie <pk...@us...> - 2005-08-12 13:52:01
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5896/scripts Modified Files: Tag: development_xmlrqp stackXML.php Log Message: Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.11 retrieving revision 1.13.2.12 diff -C2 -d -r1.13.2.11 -r1.13.2.12 *** stackXML.php 10 Aug 2005 11:49:12 -0000 1.13.2.11 --- stackXML.php 12 Aug 2005 13:51:54 -0000 1.13.2.12 *************** *** 841,844 **** --- 841,883 ---- } + function stack_xml_parse_element_into_array(&$element,&$array) + { + $noChildren = count($element); + + for ($i = 0; $i < $noChildren; $i++) { + $node = &$element[$i]; + + print_r($node->nodeName); + + //Add this element to the array given, depending on the type of node found + //Does it have children + //If so which type? + //If node has children + if ($node->childNodes!=null) + { + //We need to check what type these child nodes are.. + //3==text node - not really a child as such + if ($node->childNodes[0]->nodeType==3) + { + //print_r($node->nodeName); + $array[$node->nodeName]=$node->getText(); + } + + //1==element - another child, so recurse + else if ($node->childNodes[0]->nodeType==1); + { + print_r("Here"); + stack_xml_parse_element_into_array($element[$node->nodeName],$array); + } + } + + //If node has not got children + else + { + $array[$node->nodeName]=$node->getText(); + } + } + } + function stack_xml_parse_question(&$questionXmlDoc) { *************** *** 851,856 **** //1. Retrieve dublin core, learning object model and stack core elements if they exist ! $nodeList = &$questionXmlDoc->documentElement->childNodes; foreach ($nodeList as $node) { --- 890,914 ---- //1. Retrieve dublin core, learning object model and stack core elements if they exist ! $elements = &$questionXmlDoc->documentElement->childNodes; + stack_xml_parse_element_into_array($elements,$question); + + show_array($question); + /*// Alle Nodes des Elemnts an array übergeben + + //add ampersand (&) after equal sign for PHP4 compatability + $node =& $elements->item($i); + + //$numChildren = $node->childCount; + + for ($j = 0; $j < $numChildren; $j++) { + ///get reference to current child node + $currChildNode =& $node->childNodes[$j]; + + //echo node value of text node + echo $currChildNode->getText(); + } + } + foreach ($nodeList as $node) { *************** *** 863,868 **** --- 921,959 ---- { print_r($node->nodeName); + $question[$node->nodeName]=$node->getText(); } + //1==element - another child + else if ($node->childNodes[0]->nodeType==1); + { + //Therefore we have an array of data + $question[$node->nodeName]= array(); + + foreach ($node->childNodes as $child) + { + if ($child->childNodes!=null) + { + if ($child->childNodes[0]->nodeType==3) + { + $question[$node->nodeName][$child->nodeName]==$child->getText(); + } + + //Must have more elements + else if ($child->childNodes[0]->nodeType==1) + { + $question[$node->nodeName][$cihld->nodeName]==array(); + } + + } + + //Else childnode does not contain data + else + { + $question[$node->nodeName][$child->nodeName]=$child->getText(); + + //We need to recurse + + + *************** *** 873,876 **** --- 964,968 ---- { print_r($node->nodeName); + $question[$ode->nodeName]=$node->getText(); } } |
From: pkiddie <pk...@us...> - 2005-08-12 13:52:01
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5896 Modified Files: Tag: development_xmlrqp question_bank.php Log Message: Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8.2.3 retrieving revision 1.8.2.4 diff -C2 -d -r1.8.2.3 -r1.8.2.4 *** question_bank.php 10 Aug 2005 08:48:45 -0000 1.8.2.3 --- question_bank.php 12 Aug 2005 13:51:54 -0000 1.8.2.4 *************** *** 133,139 **** 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 --- 133,140 ---- 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_file($_FILES['xmlfile']['tmp_name']); // If a single question has been uploaded, edit it, if multiple // questions store them in the database |
From: pkiddie <pk...@us...> - 2005-08-11 16:21:35
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2122/scripts/rqp Modified Files: Tag: development_xmlrqp RQPv1p0Server.php Log Message: Slight modifications to RQP server ServerInfo call Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/Attic/RQPv1p0Server.php,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -C2 -d -r1.1.2.2 -r1.1.2.3 *** RQPv1p0Server.php 28 Jul 2005 15:03:48 -0000 1.1.2.2 --- RQPv1p0Server.php 11 Aug 2005 16:21:18 -0000 1.1.2.3 *************** *** 1,1236 **** ! <?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{ ! * ['name']=>string [...3677 lines suppressed...] ! $cidx = $xml->FindChildElement($idx); ! ! while($cidx != false) ! ! { ! ! $ret[] = $this->desoap_anyURI($xml, $cidx, "anyURI"); ! ! } ! ! } ! ! ! ! } ! ! ?> ! ! ! |
From: pkiddie <pk...@us...> - 2005-08-10 11:49:25
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16310/scripts Modified Files: Tag: development_xmlrqp stackXML.php Log Message: Beginning to write import code for questions, quizzes and question lists Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.10 retrieving revision 1.13.2.11 diff -C2 -d -r1.13.2.10 -r1.13.2.11 *** stackXML.php 10 Aug 2005 08:44:59 -0000 1.13.2.10 --- stackXML.php 10 Aug 2005 11:49:12 -0000 1.13.2.11 *************** *** 89,94 **** }*/ - //Creates an AssessmentItem fragment, and returns the head DOMIT_Element - /** * Writes a single stackQuestion data structure as XML, and returns the containing --- 89,92 ---- *************** *** 105,143 **** unset($question['questionID']); } - // Make sure the question is validated. stack_question_validate($question,$errors); $xmlDoc = new DOMIT_Document(); ! $xmlDoc->setNamespaceAwareness(true); //We need namespace awareness here ! $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); $questionFrag = &stack_xml_create_question_frag_new($question); ! //questionFrag head node is <assessmentItem> ! //We need to add namespaces etc to it. ! stack_xml_create_question_instance_header($questionFrag); ! $xmlDoc->appendChild($questionFrag); //Append questionFrag to an DOM Document - return $xmlDoc; } ! //Takes a question and returns an AssessmentItem element to the calling function function stack_xml_create_question_frag_new($question) { ! global $stackQuestion, $stack_ver, $xmlNamespaces; ! ! $xmlDoc = new DOMIT_Document(); ! ! $questionFrag = new DOMIT_Element('assessmentItem'); ! //Iterate through the question fields, then picking out the respective fields - and only write out if they contain a metatag ! //For this we need to iterate through both the question and stackQuestion structures. ! //Then we retrieve the actual data within the question structure foreach($stackQuestion as $qfield => $attribs) { ! //Now construct the main body of the XML file ! //1. The metadata if ('meta' == $attribs['type'] && array_key_exists($qfield,$question)) { --- 103,141 ---- unset($question['questionID']); } // Make sure the question is validated. stack_question_validate($question,$errors); $xmlDoc = new DOMIT_Document(); ! $xmlDoc->setNamespaceAwareness(true); //We need namespace awareness here ! //Append processing instructions ! $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); $questionFrag = &stack_xml_create_question_frag_new($question); ! //questionFrag head node is <assessmentItem>, add namespacing information to it ! stack_xml_create_question_instance_header($questionFrag); $xmlDoc->appendChild($questionFrag); //Append questionFrag to an DOM Document return $xmlDoc; } ! /** ! * Takes the specified stackQuestion data structure and creates the XML to represent this ! * encapsulated within an AssessmentItem element ! * ! * @param array $question The question to be exported ! * @return DOMIT_Element $questionFrag The root assessmentItem node with child question elements ! */ function stack_xml_create_question_frag_new($question) { ! global $stackQuestion, $stack_ver, $xmlNamespaces; ! ! $xmlDoc = new DOMIT_Document(); //Required for some method calls ! $questionFrag = new DOMIT_Element('assessmentItem'); ! //Construct main body of XML file ! //Iterate through each $stackQuestion field, and check for the presence in the instantiated $question foreach($stackQuestion as $qfield => $attribs) { ! //1. Write out metadata if ('meta' == $attribs['type'] && array_key_exists($qfield,$question)) { *************** *** 145,148 **** --- 143,147 ---- switch ($attribs['metatype']) { + //Type dublin core - prepend with the dc: identifier case('dublincore'): { *************** *** 151,154 **** --- 150,154 ---- } + //Type IEE learning object model - prepend with the lom: identifier case('lom'): { *************** *** 157,160 **** --- 157,161 ---- } + //Any other metadata not encapsulated by any particualar standard - do not prepend case('stack'): { *************** *** 171,179 **** } ! $metaElement->setText($question[$qfield]); //Add the contents of the field to metadata tag $questionFrag->appendChild($metaElement); } ! //We are interested in questionOptions and questionPotResp - other 'other' fields will not get written else if ('other' == $attribs['type'] && array_key_exists($qfield,$question)) { //If the field is a potential response --- 172,182 ---- } ! //Add the contents of the $question field to metadata ! $metaElement->setText($question[$qfield]); $questionFrag->appendChild($metaElement); } ! //2. The fields of type 'other' - corresponding to respective arrays ! //Only questionOptions and questionPotResp are written out - other 'other' fields will not get written, as per schema else if ('other' == $attribs['type'] && array_key_exists($qfield,$question)) { //If the field is a potential response *************** *** 182,207 **** //Iterate through those reponses foreach ($question[$qfield] as $potResp) { ! ! //Create a potential response element ! $potRespElem = &$xmlDoc->createElementNS('',$qfield); //Iterate through fields of a potential response foreach ($potResp as $potRespKey => $potRespField) { ! //Create a potential response field element ! $potRespFieldElem = &$xmlDoc->createElementNS('',$potRespKey); ! ! if (is_array($potRespField)) //Test for true/false branches { foreach ($potRespField as $branchKey => $branchField) { $potRespBranchElem = &$xmlDoc->createElementNS('',$branchKey) ; ! $potRespBranchElem->setText($branchField); ! $potRespFieldElem->appendChild($potRespBranchElem); } } ! else //Otherwise is not a branched element, so just write field text { $potRespFieldElem->setText($potRespField); --- 185,206 ---- //Iterate through those reponses foreach ($question[$qfield] as $potResp) { ! $potRespElem = &$xmlDoc->createElementNS('',$qfield); //Create a potential response element //Iterate through fields of a potential response foreach ($potResp as $potRespKey => $potRespField) { ! $potRespFieldElem = &$xmlDoc->createElementNS('',$potRespKey); //Create a potential response field element ! if (is_array($potRespField)) //Test for true/false branches { + //Iterate through branched elements of a particular potential response foreach ($potRespField as $branchKey => $branchField) { $potRespBranchElem = &$xmlDoc->createElementNS('',$branchKey) ; ! $potRespBranchElem->setText($branchField); $potRespFieldElem->appendChild($potRespBranchElem); } } ! else //Otherwise is not a branched element, so just write field text { $potRespFieldElem->setText($potRespField); *************** *** 221,234 **** //Write head element $questionElement = &$xmlDoc->createElementNS('',$qfield); ! ! foreach ($question[$qfield] as $optionField => $option) { $optionElement = &$xmlDoc->createElementNS('',$optionField); ! $optionElement->setText($option); ! $questionElement->appendChild($optionElement); } } else { --- 220,232 ---- //Write head element $questionElement = &$xmlDoc->createElementNS('',$qfield); ! foreach ($question[$qfield] as $optionField => $option) { //Iterate through each set option & write out $optionElement = &$xmlDoc->createElementNS('',$optionField); ! $optionElement->setText($option); $questionElement->appendChild($optionElement); } } + //Other 'other' types. Warn user that this data will not get written out else { *************** *** 239,243 **** } ! //All other elements else if (array_key_exists($qfield,$question)) { --- 237,241 ---- } ! //3. All other elements - question paramaters and key val types else if (array_key_exists($qfield,$question)) { *************** *** 267,282 **** //Just a simple type - string etc, so just append the text to the node $questionElement->setText($question[$qfield]); ! } ! $questionFrag->appendChild($questionElement); ! } } - return $questionFrag; } ! //Takes the assessmentItem fragment, constructs a filename and saves it out to XML ! //Returns true if file was successfully written out, false otherwise function stack_xml_write_question_new($question,$directory) { --- 265,284 ---- //Just a simple type - string etc, so just append the text to the node $questionElement->setText($question[$qfield]); ! } $questionFrag->appendChild($questionElement); ! } } return $questionFrag; } ! ! /** ! * Writes the specified $question to an XML file, whose filename is constructed from the $question name ! * ! * @param array $question The question to be exported ! * @param string $directory The absolute directory to which the XML file should be saved into ! * @return string $xml_file_name The name of the XML file to allow user to download, if the save was successful. Otherwise null ! */ function stack_xml_write_question_new($question,$directory) { *************** *** 288,294 **** } ! $xmlDoc = stack_xml_create_question_new($question); ! ! $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); if (!$success) --- 290,295 ---- } ! $xmlDoc = stack_xml_create_question_new($question); //Create the assessmentItem XML fragment ! $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); //Attempt to save XML file to requested directory if (!$success) *************** *** 300,306 **** } ! //Retrieve the list of questions which correspond to a particular quiz ! //Then call stack_xml_create_question_new, to create each individual assessmentItem ! //Wrap around a mathQuiz container function stack_xml_create_quiz_new($quiz) { --- 301,312 ---- } ! /** ! * Writes a single stackQuiz data structure as XML, retreiving each individual question. R ! * Returns the containing XML document to the calling function ! * ! * @see stack_xml_create_quiz_frag_new() ! * @param array $quiz A stackQuiz data structure ! * @return DOMIT_Document The XML document representing the quiz ! */ function stack_xml_create_quiz_new($quiz) { *************** *** 314,322 **** } $quizFrag = stack_xml_create_quiz_frag_new($quiz); - //show_array($quiz); - //<TODO> Does the quiz have any questions attached. If not, is there any point writing out?? if (!empty($quiz['questions'])) { --- 320,328 ---- } + //Create the quiz level metadata and options, wrapped in a <mathQuiz> container $quizFrag = stack_xml_create_quiz_frag_new($quiz); //<TODO> Does the quiz have any questions attached. If not, is there any point writing out?? + //Currently we do... if (!empty($quiz['questions'])) { *************** *** 325,346 **** { ! $question = stack_db_getquestion($question['questionID']); //Get the questionId from the question stack_question_validate($question,$errors); //Validate it unset($question['questionID']); ! $questionFrag = &stack_xml_create_question_frag_new($question); ! $quizFrag->appendChild($questionFrag); } } ! //quizItem head node is <mathQuiz> ! //We need to add namespaces etc to it. stack_xml_create_quiz_instance_header($quizFrag); ! $xmlDoc->appendChild($quizFrag); //Append quizItem to DOM Document... return to calling function return $xmlDoc; } ! //<TODO> Here we need to write out quiz level metadata and options function stack_xml_create_quiz_frag_new($quiz) { --- 331,364 ---- { ! $question = stack_db_getquestion($question['questionID']); //Get the questionId from the question data structure stack_question_validate($question,$errors); //Validate it unset($question['questionID']); ! $questionFrag = &stack_xml_create_question_frag_new($question); //Write <assessmentItem> corresponding to this question ! $quizFrag->appendChild($questionFrag); //Append onto <mathQuiz> element } } ! //No questions attached to quiz ! /*else ! { ! return null; ! }*/ ! ! //We need to add namespacing information to <mathQuiz> head element stack_xml_create_quiz_instance_header($quizFrag); ! ! $xmlDoc->appendChild($quizFrag); return $xmlDoc; } ! /** ! * Takes the specified stackQuiz data structure and creates the XML to represent the quiz ! * level metadata and options, if they exist. Returns a <mathQuiz> element ! * ! * @param array $question The quiz to be exported ! * @return DOMIT_Element $quizFrag The root mathQuiz node with child quiz elements ! */ function stack_xml_create_quiz_frag_new($quiz) { *************** *** 348,380 **** $xmlDoc = new DOMIT_Document(); - $quizFrag = new DOMIT_Element('mathQuiz'); foreach($stackQuiz as $quizField => $attribs) { if ('meta' == $attribs['type'] && array_key_exists($quizField,$quiz)) { ! //Detect the metadata type switch ($attribs['metatype']) { ! case('dublincore'): ! { $metaElement =&$xmlDoc->createElementNS($xmlNamespaces['dc']['namespace'],"{$xmlNamespaces['dc']['id']}:{$attribs['metatag']}"); break; } ! case('lom'): ! { $metaElement =&$xmlDoc->createElementNS($xmlNamespaces['lom']['namespace'],"{$xmlNamespaces['lom']['id']}:{$attribs['metatag']}"); break; } ! case('stack'): ! { $metaElement =&$xmlDoc->createElementNS('',"{$attribs['metatag']}"); break; } ! case('default'): ! { $metaElement =&$xmlDoc->createElementNS('',"{$attribs['metatag']}"); break; --- 366,396 ---- $xmlDoc = new DOMIT_Document(); $quizFrag = new DOMIT_Element('mathQuiz'); + //Iterate through each of the top level fields in the quiz foreach($stackQuiz as $quizField => $attribs) { + //1. Write out quiz level metadata if ('meta' == $attribs['type'] && array_key_exists($quizField,$quiz)) { ! ! //Detect the metadata type switch ($attribs['metatype']) { ! case('dublincore'): { $metaElement =&$xmlDoc->createElementNS($xmlNamespaces['dc']['namespace'],"{$xmlNamespaces['dc']['id']}:{$attribs['metatag']}"); break; } ! case('lom'): { $metaElement =&$xmlDoc->createElementNS($xmlNamespaces['lom']['namespace'],"{$xmlNamespaces['lom']['id']}:{$attribs['metatag']}"); break; } ! case('stack'): { $metaElement =&$xmlDoc->createElementNS('',"{$attribs['metatag']}"); break; } ! case('default'): { $metaElement =&$xmlDoc->createElementNS('',"{$attribs['metatag']}"); break; *************** *** 383,391 **** } ! $metaElement->setText($quiz[$quizField]); //Add the contents of the field to metadata tag $quizFrag->appendChild($metaElement); } ! //We are interested in quizOptions else if ('other' == $attribs['type'] && array_key_exists($quizField,$quiz)) { --- 399,407 ---- } ! $metaElement->setText($quiz[$quizField]); $quizFrag->appendChild($metaElement); } ! //2. Write out quiz level options else if ('other' == $attribs['type'] && array_key_exists($quizField,$quiz)) { *************** *** 394,398 **** //Write head element $quizElement = &$xmlDoc->createElementNS('',$quizField); ! if (is_array('quizOptions')) { --- 410,415 ---- //Write head element $quizElement = &$xmlDoc->createElementNS('',$quizField); ! ! //2.1 Quiz level options may not be an array if (is_array('quizOptions')) { *************** *** 400,405 **** $optionElement = &$xmlDoc->createElementNS('',$optionField); ! $optionElement->setText($option); ! $quizElement->appendChild($optionElement); } --- 417,421 ---- $optionElement = &$xmlDoc->createElementNS('',$optionField); ! $optionElement->setText($option); $quizElement->appendChild($optionElement); } *************** *** 407,410 **** --- 423,427 ---- } + //3. Catch any other 'other' types and inform the developer else { *************** *** 415,419 **** } ! //All other elements else if (array_key_exists($quizField,$quiz)) { --- 432,436 ---- } ! //Any other elements - quizDueDate, quizMode etc. else if (array_key_exists($quizField,$quiz)) { *************** *** 424,429 **** $quizElement->setText($quiz[$quizField]); ! $quizFrag->appendChild($quizElement); ! } } --- 441,445 ---- $quizElement->setText($quiz[$quizField]); ! $quizFrag->appendChild($quizElement); } } *************** *** 431,437 **** return $quizFrag; } - ! //Writes a quiz to an XML file function stack_xml_write_quiz_new($quiz,$directory) { --- 447,458 ---- return $quizFrag; } ! /** ! * Writes the specified $quiz to an XML file, whose filename is constructed from the $quiz name ! * ! * @param array $question The quiz to be exported ! * @param string $directory The absolute directory to which the XML file should be saved into ! * @return string $xml_file_name The name of the XML file to allow user to download, if the save was successful. Otherwise null ! */ function stack_xml_write_quiz_new($quiz,$directory) { *************** *** 449,454 **** ! $xmlDoc = stack_xml_create_quiz_new($quiz); ! $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); --- 470,474 ---- ! $xmlDoc = stack_xml_create_quiz_new($quiz); $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); *************** *** 458,478 **** } ! return $xml_file_name; ! } ! //The only difference between a quiz and a list of questions is that a list ! //of questions will not have metadata/quiz level options attached to it ! //Thus the main container is still mathQuiz, but this contains multiple assessmentItems function stack_xml_write_question_list($questionList,$directory) { $xml_file_name = 'stack_quiz_'.time().'.xml'; - $xmlDoc = stack_xml_create_question_list($questionList); $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); ! if (!$success) ! { return null; } --- 478,507 ---- } ! return $xml_file_name; } ! /** ! * Writes the specified $questionList to an XML file. The filename is default to the time which it was saved. ! * A list of questions will not have either quiz level metadata or options attached to it, but will still be wrapped around ! * a mathQuiz container ! * ! * @param array $questionList The questionList to be exported. ! * @param string $directory The absolute directory to which the XML file should be saved into ! * @return string $xml_file_name The name of the XML file to allow user to download, if the save was successful. Otherwise null ! */ function stack_xml_write_question_list($questionList,$directory) { $xml_file_name = 'stack_quiz_'.time().'.xml'; $xmlDoc = stack_xml_create_question_list($questionList); + if (!empty($xmlDoc)) { $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); + } ! else { ! return null; ! } ! ! if (!$success) { return null; } *************** *** 481,484 **** --- 510,521 ---- } + /** + * Writes a single questionList data structure as XML, retreiving each individual question from the list + * Returns the containing XML document to the calling function + * + * @see stack_xml_create_question_list_frag() + * @param array $quiz A stackQuiz data structure + * @return DOMIT_Document The XML document representing the quiz + */ function stack_xml_create_question_list($questionList) { *************** *** 487,495 **** $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); ! //show_array($questionList); ! $quizFrag = stack_xml_create_question_list_frag($questionList); ! //<TODO> Does the quiz have any questions attached. If not, is there any point writing out?? ! if (!empty($questionList)) { //Retrieve each question individually --- 524,531 ---- $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); ! //Create <mathQuiz> container ! $quizFrag = stack_xml_create_question_list_frag(); ! if (!empty($questionList)) //Check for the presence of questions - another line of defense { //Retrieve each question individually *************** *** 506,538 **** } //quizItem head node is <mathQuiz> //We need to add namespaces etc to it. stack_xml_create_quiz_instance_header($quizFrag); ! $xmlDoc->appendChild($quizFrag); //Append quizItem to DOM Document... return to calling function return $xmlDoc; } function stack_xml_create_question_list_frag() ! { ! global $stackQuiz, $xmlNamespaces; ! $xmlDoc = new DOMIT_Document(); $quizFrag = new DOMIT_Element('mathQuiz'); ! return $quizFrag; } /** * Takes the head element of a a question XML file and adds namespacing and version information to it. - * $namespaces['xs']['namespace'] = Uri where external schema is located - * $namespaces['xs']['id'] = Id of which elements which are defined from this schema are prepended with * ! * Also adds a version to the schema, based upon the current release of STACK. * ! * @see stack_xml_create_question_schema() ! * @param array $namespacesArray The above Xmlnamespaces data structure ! * @param string $rootElem The name of the root Xml element * @return void */ --- 542,585 ---- } + //No questions to export + else + { + return null; + } + //quizItem head node is <mathQuiz> //We need to add namespaces etc to it. stack_xml_create_quiz_instance_header($quizFrag); ! $xmlDoc->appendChild($quizFrag); return $xmlDoc; } + /** + * Returns a simple <mathQuiz> head element when a list of questions is being exported + * + * @param void + * @return DOMIT_Element $quListFrag The root mathQuiz node. + */ function stack_xml_create_question_list_frag() ! { $xmlDoc = new DOMIT_Document(); $quizFrag = new DOMIT_Element('mathQuiz'); ! return $quListFrag; } /** * Takes the head element of a a question XML file and adds namespacing and version information to it. * ! * Requires global data structure $xmlNamespaces, which has format: ! * $namespaces['dc']['namespace'] = Uri where external schema is located ! * $namespaces['dc']['id'] = Id of which elements which are defined from this schema are prepended with * ! * Also adds a version to the head question element, based upon the current release of STACK. ! * ! * @see stack_xml_create_question_new() ! * @param DOMIT_Element &$headElement The element to which the namespacing information will be appended to, by reference * @return void */ *************** *** 551,555 **** //Now must give location of schema from which this instance has been derived from $schemaLocationAttr = new DOMIT_Attr('xsi:noNamespaceSchemaLocation'); ! $schemaLocationAttr->nodeValue="{$stack_root}/schemas/".questionSchemaName; //Used to ensure latest schema version is used --- 598,602 ---- //Now must give location of schema from which this instance has been derived from $schemaLocationAttr = new DOMIT_Attr('xsi:noNamespaceSchemaLocation'); ! $schemaLocationAttr->nodeValue="{$stack_root}/schemas/".questionSchemaName; //Use 'define' above //Used to ensure latest schema version is used *************** *** 561,564 **** --- 608,625 ---- } + /** + * Takes the head element of a a quiz XML file and adds namespacing and version information to it. + * + * Requires global data structure $xmlNamespaces, which has format: + * $namespaces['dc']['namespace'] = Uri where external schema is located + * $namespaces['dc']['id'] = Id of which elements which are defined from this schema are prepended with + * + * Also adds a version to the head quiz element, based upon the current release of STACK. + * + * @see stack_xml_create_quiz_new() + * @see stack_xml_create_question_list_new() + * @param DOMIT_Element &$headElement The element to which the namespacing information will be appended to, by reference + * @return void + */ function stack_xml_create_quiz_instance_header(&$headElement) { *************** *** 575,579 **** //Now must give location of schema from which this instance has been derived from $schemaLocationAttr = new DOMIT_Attr('xsi:noNamespaceSchemaLocation'); ! $schemaLocationAttr->nodeValue="{$stack_root}/schemas/".quizSchemaName; //Used to ensure latest schema version is used --- 636,640 ---- //Now must give location of schema from which this instance has been derived from $schemaLocationAttr = new DOMIT_Attr('xsi:noNamespaceSchemaLocation'); ! $schemaLocationAttr->nodeValue="{$stack_root}/schemas/".quizSchemaName; //Use 'define' above //Used to ensure latest schema version is used *************** *** 706,709 **** --- 767,957 ---- } + //This function is called when Question->Import is selected. + //In this case, the user is either: + //1. Uploading a XML file containing a single question + //2. An XML file with an array of questions. + //Either return a question, or quiz data structure, then detect the head element? + function stack_xml_parse_question_file($fileName) + { + $xmlDoc = &new DOMIT_Document(); + $xmlDoc->setNamespaceAwareness(true); + $success = $xmlDoc->loadXML($fileName); + + //In the first instance, check what type of file we are dealing with + //Retrieve the document element + $headElementName = $xmlDoc->documentElement->nodeName; + + switch ($headElementName) + { + case('assessmentItem'): + { + //A single question + $question = stack_xml_parse_question($xmlDoc); + break; + } + + case('mathQuiz'): + { + //A list of questions + $questionList = stack_xml_parse_question_list($xmlDoc); + + break; + } + + default: + { + //Any other head element + return null; + break; + } + } + } + + //This function is called when Quiz->Import is selected. + //The user is simply trying to import a quiz file + //1. Uploading a XML file containing a quiz + function stack_xml_parse_quiz_file($fileName) + { + $xmlDoc = &new DOMIT_Document(); + $xmlDoc->setNamespaceAwareness(true); + $success = $xmlDoc->loadXML($fileName); + + + //In the first instance, check what type of file we are dealing with + //Retrieve the document element + $headElementName = $xmlDoc->documentElement->nodeName; + + switch ($headElementName) + { + //A quiz + case('mathQuiz'): + { + $quiz = stack_xml_parse_quiz($xmlDoc); + break; + } + + //Any other type + default: + { + break; + + } + } + + } + + function stack_xml_parse_question(&$questionXmlDoc) + { + global $namespaces, $stackQuestion; + + $question = array(); + + //1. Retrieve dublin core elements if any exist + //$dcNodeList =&$questionXmlDoc->getElementsByTagNameNS($namespaces['dc']['namespace'],'*'); + + //1. Retrieve dublin core, learning object model and stack core elements if they exist + $nodeList = &$questionXmlDoc->documentElement->childNodes; + + foreach ($nodeList as $node) + { + //If node has children + if ($node->childNodes!=null) + { + //We need to check what type these child nodes are.. + //3==text node - not really a child as such + if ($node->childNodes[0]->nodeType==3) + { + print_r($node->nodeName); + } + + + + } + + //If node has not got children + else + { + print_r($node->nodeName); + } + } + + //Need to use nodeType + + //Now iterate through those nodes prepended by the dublin core namespace + for ($i=0; $i<$dcNodeList->getLength(); $i++) + { + $dcNode = &$dcNodeList->item($i); + //Check against the stackQuestion data structure + foreach($stackQuestion as $arrayKey=>$questionField) + { + $nodeName=explode(":",$dcNode->nodeName); + + //print_r($nod + + if (!empty($questionField['metatag']) && $questionField['metatag']==$nodeName[1]) + { + //show_array($questionField); + //We know we have found the corresponding stackQuestion tag + //print_r($dcNode->nodeName); + //print_r($dcNode->getText()); + $question[$arrayKey]=$dcNode->getText(); + break; + } + + } + } + + //2. Retrieve lom elements if any exist + $lomNodeList = &$questionXmlDoc->getElementsByTagNameNS($namespaces['lom']['namespace'],'*'); + + //Now iterate through those nodes prepended by the dublin core namespace + for ($i=0; $i<$lomNodeList->getLength(); $i++) + { + $lomNode = &$lomNodeList->item($i); + //Check against the stackQuestion data structure + foreach($stackQuestion as $arrayKey=>$questionField) + { + $nodeName=explode(":",$lomNode->nodeName); + + //print_r($nod + + if (!empty($questionField['metatag']) && $questionField['metatag']==$nodeName[1]) + { + //show_array($questionField); + //We know we have found the corresponding stackQuestion tag + //print_r($dcNode->nodeName); + //print_r($dcNode->getText()); + $question[$arrayKey]=$lomNode->getText(); + break; + } + + } + } + + show_array($question); + //print_r($retItem->nodeName); + //print_r($retItem->getText()); + //print_r("<br>"); + + //3. Then any other elements who do not have children + //$stackNode + + /*foreach ($questionXmlDoc->documentElement->childNodes as $childElement) + { + //This is not a potential response, options, or types with keyvals + if ($childElement->childNodes==null) + { + switch($childElement->*/ + + + } + + function stack_xml_parse_quiz() + { + } + + function stack_xml_parse_question_list() + { + } /** |
From: pkiddie <pk...@us...> - 2005-08-10 08:48:54
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15907/scripts Modified Files: Tag: development_xmlrqp stackAuthor.php stackQuiz.php Log Message: Editquiz.php added to, to allow the exporting of quiz XML files Lists of questions now exportable with new code in stackXML StackQuiz data structure updated Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.5 retrieving revision 1.5.2.1 diff -C2 -d -r1.5 -r1.5.2.1 *** stackQuiz.php 22 Jul 2005 12:47:41 -0000 1.5 --- stackQuiz.php 10 Aug 2005 08:48:46 -0000 1.5.2.1 *************** *** 14,78 **** $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', --- 14,93 ---- $stackQuiz['quizid']['descript'] = 'Quiz ID number'; $stackQuiz['quizid']['mysql'] = 'INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; + //$stackQuiz['quizid']['type'] = 'meta'; <TODO> Why does this duff the quiz edite // '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'; // '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', *************** *** 80,102 **** $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', --- 95,120 ---- $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']='unspecified'; //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', *************** *** 105,122 **** $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', --- 123,142 ---- $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', *************** *** 124,153 **** $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'; --- 144,178 ---- $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']='0'; //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'; Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.29.2.1 retrieving revision 1.29.2.2 diff -C2 -d -r1.29.2.1 -r1.29.2.2 *** stackAuthor.php 28 Jul 2005 13:49:33 -0000 1.29.2.1 --- stackAuthor.php 10 Aug 2005 08:48:46 -0000 1.29.2.2 *************** *** 663,667 **** */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! global $_PHP_SELF,$stackQuiz,$stackOptions; if (empty($PostTo)) { --- 663,667 ---- */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; if (empty($PostTo)) { *************** *** 757,761 **** stack_quiz_metadata_edit_form($quiz, $metadata_list); ! // The end of the form! --- 757,771 ---- 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! |
From: pkiddie <pk...@us...> - 2005-08-10 08:48:53
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15907 Modified Files: Tag: development_xmlrqp editquiz.php question_bank.php Log Message: Editquiz.php added to, to allow the exporting of quiz XML files Lists of questions now exportable with new code in stackXML StackQuiz data structure updated Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.13 retrieving revision 1.13.2.1 diff -C2 -d -r1.13 -r1.13.2.1 *** editquiz.php 14 Jul 2005 17:59:12 -0000 1.13 --- editquiz.php 10 Aug 2005 08:48:45 -0000 1.13.2.1 *************** *** 65,69 **** $question_bank_filter = stack_get_questionbank_filter(); - //////////////////////////////////////////////// // (2) Take any actions required on entry to the page --- 65,68 ---- *************** *** 77,80 **** --- 76,81 ---- // quiz_edit_addqs Add questions to the quiz. // filter Re-display the list of questions, filtered. + // quiz_xml Export the current quiz as an XML file + // quiz_xml_db Export single quiz as XML from database *************** *** 89,92 **** --- 90,100 ---- $quizid_source = 'database'; } + + else if ('quiz_xml' == $action) { + $quizid_source = 'post'; + } + else if ('quiz_xml_db' == $action) { + $quizid_source = 'database'; + } if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { *************** *** 97,103 **** } } ! $quizid = stack_get_quizid($quizid_source, $quiz); ! if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { $quiz = stack_get_quiz('database', $quizid); --- 105,111 ---- } } ! $quizid = stack_get_quizid($quizid_source, $quiz); ! if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { $quiz = stack_get_quiz('database', $quizid); *************** *** 136,139 **** --- 144,155 ---- $action = 'quiz_edit'; } + + if ('quiz_xml' == $action) { + + include_once("{$stack_root}/scripts/stackXML.php"); + + $quiz = stack_get_quiz('database', $quizid); + $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); + } //////////////////////////////////////////////// *************** *** 154,159 **** stack_db_listquestions_quiz($question_bank_filter,$quizid); break; ! case 'quiz_xml'; ! echo "This feature is not yet implemented."; } --- 170,183 ---- stack_db_listquestions_quiz($question_bank_filter,$quizid); break; ! case 'quiz_xml': ! { ! echo "<p>Please download the file <a href='{$stack_web_url}tmp/{$name}'>$name</a>.</p>"; ! $action = 'quizbank_screen'; ! } ! } ! ! switch ($action) { ! case 'quizbank_screen': ! echo"<br>The main quiz screen should be shown here<br>"; } Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.8.2.2 retrieving revision 1.8.2.3 diff -C2 -d -r1.8.2.2 -r1.8.2.3 *** question_bank.php 5 Aug 2005 10:44:25 -0000 1.8.2.2 --- question_bank.php 10 Aug 2005 08:48:45 -0000 1.8.2.3 *************** *** 161,165 **** $name = ''; if (NULL !== $questions_to_export) { ! $name = stack_xml_write_quiz_file($questions_to_export, "{$stack_root}/tmp/"); } $action = 'export_xml'; --- 161,165 ---- $name = ''; if (NULL !== $questions_to_export) { ! $name = stack_xml_write_question_list($questions_to_export, "{$stack_root}/tmp/"); } $action = 'export_xml'; |
From: pkiddie <pk...@us...> - 2005-08-10 08:45:10
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15083/scripts Modified Files: Tag: development_xmlrqp stackXML.php Log Message: Editquiz.php added to, to allow the exporting of quiz XML files Lists of questions now exportable with new code in stackXML StackQuiz data structure updated Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.13.2.9 retrieving revision 1.13.2.10 diff -C2 -d -r1.13.2.9 -r1.13.2.10 *** stackXML.php 8 Aug 2005 22:10:24 -0000 1.13.2.9 --- stackXML.php 10 Aug 2005 08:44:59 -0000 1.13.2.10 *************** *** 1,5 **** <?php - require_once("{$stack_root}/other/domit/xml_domit_include.php"); - /** * Defines XML handling within STACK --- 1,3 ---- *************** *** 9,12 **** --- 7,12 ---- */ + require_once("{$stack_root}/other/domit/xml_domit_include.php"); + //<PDK> sqlToSchemaMapping array maps basic SQL data types used in STAKCK to their respective XML schema data types $sqlToSchemaMapping['CHAR']='string'; *************** *** 31,35 **** $namespaces['dc']['namespace'] = 'http://purl.org/dc/elements/1.1/'; //Dublin core namespace $namespaces['dc']['id'] = 'dc'; //The ID prepended to our elements that use DC ! $namespaces['dc']['location'] = 'dc.xsd'; //The actual location of the dublin core schema $namespaces['lom']['namespace'] = 'http://www.imsglobal.org/xsd/imsmd_v1p2';//etc. --- 31,35 ---- $namespaces['dc']['namespace'] = 'http://purl.org/dc/elements/1.1/'; //Dublin core namespace $namespaces['dc']['id'] = 'dc'; //The ID prepended to our elements that use DC ! $namespaces['dc']['location'] = 'dc.xsd'; //The actual location of the dublin core schema $namespaces['lom']['namespace'] = 'http://www.imsglobal.org/xsd/imsmd_v1p2';//etc. *************** *** 40,44 **** //As above... $xmlNamespaces['dc']['namespace'] = 'http://purl.org/dc/elements/1.1/'; //Dublin core namespace ! $xmlNamespaces['dc']['id'] = 'dc'; //The ID prepended to our elements that use DC //The actual location of the dublin core schema $xmlNamespaces['lom']['namespace'] = 'http://www.imsglobal.org/xsd/imsmd_v1p2';//etc. --- 40,44 ---- //As above... $xmlNamespaces['dc']['namespace'] = 'http://purl.org/dc/elements/1.1/'; //Dublin core namespace ! $xmlNamespaces['dc']['id'] = 'dc'; //The ID prepended to our elements that use DC //The actual location of the dublin core schema $xmlNamespaces['lom']['namespace'] = 'http://www.imsglobal.org/xsd/imsmd_v1p2';//etc. *************** *** 47,53 **** //Different namespace here - schema instance $xmlNamespaces['xsi']['namespace'] = 'http://www.w3.org/2001/XMLSchema-instance'; //Schema instance - required for XML files that reflect ! $xmlNamespaces['xsi']['id'] = 'xsi'; //Particular schema ! $xmlNamespaces['xsi']['location'] = 'c:/Program Files/EasyPHP1-8/www/stack-1-0/schemas/stack-question-1.0.xsd'; //Actual location of our schema /** --- 47,55 ---- //Different namespace here - schema instance $xmlNamespaces['xsi']['namespace'] = 'http://www.w3.org/2001/XMLSchema-instance'; //Schema instance - required for XML files that reflect ! $xmlNamespaces['xsi']['id'] = 'xsi'; //Particular schema + //Constants for schema file names, used throughout: creation of schema file names and referencing those schemas in XML files + define ('questionSchemaName',"stack_question-{$stack_ver['release']}.xsd"); + define ('quizSchemaName',"stack_quiz-{$stack_ver['release']}.xsd"); /** *************** *** 58,62 **** * @return string The XML string representing the question */ ! function stack_xml_create_question($question) { // Takes a $stackQuestion array, and returns an XML string global $stackQuestion; --- 60,64 ---- * @return string The XML string representing the question */ ! /*function stack_xml_create_question($question) { // Takes a $stackQuestion array, and returns an XML string global $stackQuestion; *************** *** 85,95 **** return $xml; ! } //Creates an AssessmentItem fragment, and returns the head DOMIT_Element function stack_xml_create_question_new($question) { - global $stackQuestion, $stack_ver, $xmlNamespaces; - // Don't export questionID if (array_key_exists('questionID',$question)) { --- 87,104 ---- return $xml; ! }*/ //Creates an AssessmentItem fragment, and returns the head DOMIT_Element + + /** + * Writes a single stackQuestion data structure as XML, and returns the containing + * XML document to the calling function + * + * @see stack_xml_create_question_frag_new() + * @param array $question A stackQuestion data structure + * @return DOMIT_Document The XML document representing the question + */ function stack_xml_create_question_new($question) { // Don't export questionID if (array_key_exists('questionID',$question)) { *************** *** 104,119 **** $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); ! $questionFrag = &stack_xml_create_question_frag($question); ! //Retrieve document element, then add the instance headers to it ! $questionFrag = &stack_xml_create_instance_header($xmlNamespaces,'assessmentItem'); - $xmlDoc->appendChild($questionFrag); - return $xmlDoc; } ! function stack_xml_create_question_frag($question) { $xmlDoc = new DOMIT_Document(); --- 113,132 ---- $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); ! $questionFrag = &stack_xml_create_question_frag_new($question); ! ! //questionFrag head node is <assessmentItem> ! //We need to add namespaces etc to it. ! stack_xml_create_question_instance_header($questionFrag); ! $xmlDoc->appendChild($questionFrag); //Append questionFrag to an DOM Document return $xmlDoc; } ! //Takes a question and returns an AssessmentItem element to the calling function ! function stack_xml_create_question_frag_new($question) { + global $stackQuestion, $stack_ver, $xmlNamespaces; + $xmlDoc = new DOMIT_Document(); *************** *** 269,273 **** { //Create question filename ! if ($question['questionName'] != '') { $xml_file_name = $question['questionName'].".xml"; } else { --- 282,286 ---- { //Create question filename ! if (!empty($question['questionName'])) { $xml_file_name = $question['questionName'].".xml"; } else { *************** *** 292,305 **** function stack_xml_create_quiz_new($quiz) { ! //foreach() ! //stack_xml_create_question_frag($question); } //Writes a quiz to an XML file function stack_xml_write_quiz_new($quiz,$directory) { //<TODO> How about using Quiz name? ! $xml_file_name = 'stack_quiz_'.time().'.xml'; $xmlDoc = stack_xml_create_quiz_new($quiz); --- 305,451 ---- function stack_xml_create_quiz_new($quiz) { ! $xmlDoc = new DOMIT_Document(); ! $xmlDoc->setNamespaceAwareness(true); //We need namespace awareness here ! $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); ! ! // Don't export quizID ! if (array_key_exists('quizid',$quiz)) { ! unset($quiz['quizid']); ! } ! ! $quizFrag = stack_xml_create_quiz_frag_new($quiz); ! ! //show_array($quiz); + //<TODO> Does the quiz have any questions attached. If not, is there any point writing out?? + if (!empty($quiz['questions'])) + { + //Retrieve each question individually + foreach ($quiz['questions'] as $question) + { + + $question = stack_db_getquestion($question['questionID']); //Get the questionId from the question + stack_question_validate($question,$errors); //Validate it + + unset($question['questionID']); + + $questionFrag = &stack_xml_create_question_frag_new($question); + $quizFrag->appendChild($questionFrag); + } + } + + //quizItem head node is <mathQuiz> + //We need to add namespaces etc to it. + stack_xml_create_quiz_instance_header($quizFrag); + $xmlDoc->appendChild($quizFrag); //Append quizItem to DOM Document... return to calling function + return $xmlDoc; } + //<TODO> Here we need to write out quiz level metadata and options + function stack_xml_create_quiz_frag_new($quiz) + { + global $stackQuiz, $xmlNamespaces; + + $xmlDoc = new DOMIT_Document(); + + $quizFrag = new DOMIT_Element('mathQuiz'); + + foreach($stackQuiz as $quizField => $attribs) + { + if ('meta' == $attribs['type'] && array_key_exists($quizField,$quiz)) { + //Detect the metadata type + switch ($attribs['metatype']) + { + case('dublincore'): + { + $metaElement =&$xmlDoc->createElementNS($xmlNamespaces['dc']['namespace'],"{$xmlNamespaces['dc']['id']}:{$attribs['metatag']}"); + break; + } + + case('lom'): + { + $metaElement =&$xmlDoc->createElementNS($xmlNamespaces['lom']['namespace'],"{$xmlNamespaces['lom']['id']}:{$attribs['metatag']}"); + break; + } + + case('stack'): + { + $metaElement =&$xmlDoc->createElementNS('',"{$attribs['metatag']}"); + break; + } + + case('default'): + { + $metaElement =&$xmlDoc->createElementNS('',"{$attribs['metatag']}"); + break; + } + + } + + $metaElement->setText($quiz[$quizField]); //Add the contents of the field to metadata tag + $quizFrag->appendChild($metaElement); + } + + //We are interested in quizOptions + else if ('other' == $attribs['type'] && array_key_exists($quizField,$quiz)) { + + if ($quizField=='quizOptions') + { + //Write head element + $quizElement = &$xmlDoc->createElementNS('',$quizField); + + if (is_array('quizOptions')) + { + foreach ($quiz[$quizField] as $optionField => $option) { + + $optionElement = &$xmlDoc->createElementNS('',$optionField); + $optionElement->setText($option); + + $quizElement->appendChild($optionElement); + } + } + } + + else + { + echo("The field $quizField cannot be written out"); + } + + $quizFrag->appendChild($quizElement); + } + + //All other elements + else if (array_key_exists($quizField,$quiz)) { + + //Write head element + $quizElement = &$xmlDoc->createElementNS('',$quizField); + + //Just a simple type - string etc, so just append the text to the node + $quizElement->setText($quiz[$quizField]); + + $quizFrag->appendChild($quizElement); + + } + } + + return $quizFrag; + } + + //Writes a quiz to an XML file function stack_xml_write_quiz_new($quiz,$directory) { //<TODO> How about using Quiz name? ! if (!empty($quiz['quizName'])) ! { ! $xml_file_name = 'stack_quiz_'.$quiz['quizName'].'.xml'; ! } ! ! //Append time if no name has been found ! else ! { ! $xml_file_name = 'stack_quiz_'.time().'.xml'; ! } ! $xmlDoc = stack_xml_create_quiz_new($quiz); *************** *** 313,348 **** return $xml_file_name; } - - if (!$xml_file_handle) { - // error condition - echo "File could not be opened for writing."; - } else { - $xml = "<?xml version=\"1.0\"?>\n"; - $xml .= "<mathQuiz>\n"; - - $errors = NULL; - foreach ($quiz as $questionID) - { - $question = stack_db_getquestion($questionID); - stack_question_validate($question,$errors); - unset($question['questionID']); - $quizQ['assessmentItem'][]= $question; - } ! $xml .= stack_xml_create_question_frag($quizQ,4); ! $xml .= '</mathQuiz>'; ! fputs($xml_file_handle, $xml); ! // close xml file ! fclose($xml_file_handle); ! } ! return $xml_file_name; } /** ! * Creates a XML schema header based upon a XML namespaces datastructure, defined in the following manner: * $namespaces['xs']['namespace'] = Uri where external schema is located * $namespaces['xs']['id'] = Id of which elements which are defined from this schema are prepended with --- 459,530 ---- return $xml_file_name; + } ! //The only difference between a quiz and a list of questions is that a list ! //of questions will not have metadata/quiz level options attached to it ! //Thus the main container is still mathQuiz, but this contains multiple assessmentItems ! function stack_xml_write_question_list($questionList,$directory) ! { ! $xml_file_name = 'stack_quiz_'.time().'.xml'; ! ! $xmlDoc = stack_xml_create_question_list($questionList); ! ! $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); ! ! if (!$success) ! { ! return null; ! } ! ! return $xml_file_name; ! } ! function stack_xml_create_question_list($questionList) ! { ! $xmlDoc = new DOMIT_Document(); ! $xmlDoc->setNamespaceAwareness(true); //We need namespace awareness here ! $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); ! ! //show_array($questionList); ! $quizFrag = stack_xml_create_question_list_frag($questionList); ! ! //<TODO> Does the quiz have any questions attached. If not, is there any point writing out?? ! if (!empty($questionList)) ! { ! //Retrieve each question individually ! foreach ($questionList as $questionID) ! { ! $question = stack_db_getquestion($questionID); //Get the questionId from the question ! stack_question_validate($question,$errors); //Validate it ! ! unset($question['questionID']); ! ! $questionFrag = &stack_xml_create_question_frag_new($question); ! $quizFrag->appendChild($questionFrag); ! } ! } ! ! //quizItem head node is <mathQuiz> ! //We need to add namespaces etc to it. ! stack_xml_create_quiz_instance_header($quizFrag); ! $xmlDoc->appendChild($quizFrag); //Append quizItem to DOM Document... return to calling function ! return $xmlDoc; ! } ! function stack_xml_create_question_list_frag() ! { ! global $stackQuiz, $xmlNamespaces; ! ! $xmlDoc = new DOMIT_Document(); ! ! $quizFrag = new DOMIT_Element('mathQuiz'); + return $quizFrag; } + /** ! * Takes the head element of a a question XML file and adds namespacing and version information to it. * $namespaces['xs']['namespace'] = Uri where external schema is located * $namespaces['xs']['id'] = Id of which elements which are defined from this schema are prepended with *************** *** 353,376 **** * @param array $namespacesArray The above Xmlnamespaces data structure * @param string $rootElem The name of the root Xml element ! * @return DOMIT_Element $schemaHeader The XML schema header, which may be appended onto the DOM Document root node */ ! function stack_xml_create_instance_header($namespacesArray,$rootName) { ! global $stack_ver; //Retrieve current release of STACK ! //Contruct the header for the schema ! $schemaHeader = new DOMIT_Element($rootName); ! foreach ($namespacesArray as $namespaceKey=>$namespace) //Iterate through each namespace and add to schema header { $namespaceAttr = &new DOMIT_Attr('xmlns:'.$namespaceKey); $namespaceAttr->nodeValue=$namespace['namespace']; ! $schemaHeader->setAttributeNode($namespaceAttr); } //Now must give location of schema from which this instance has been derived from $schemaLocationAttr = new DOMIT_Attr('xsi:noNamespaceSchemaLocation'); ! $schemaLocationAttr->nodeValue=$namespacesArray['xsi']['location']; //Used to ensure latest schema version is used --- 535,579 ---- * @param array $namespacesArray The above Xmlnamespaces data structure * @param string $rootElem The name of the root Xml element ! * @return void */ ! function stack_xml_create_question_instance_header(&$headElement) { ! global $stack_ver, $xmlNamespaces, $stack_root; //Retrieve current release of STACK ! foreach ($xmlNamespaces as $namespaceKey=>$namespace) //Iterate through each namespace and add to schema header ! { ! $namespaceAttr = &new DOMIT_Attr('xmlns:'.$namespaceKey); ! $namespaceAttr->nodeValue=$namespace['namespace']; ! ! $headElement->setAttributeNode($namespaceAttr); ! } ! //Now must give location of schema from which this instance has been derived from ! $schemaLocationAttr = new DOMIT_Attr('xsi:noNamespaceSchemaLocation'); ! $schemaLocationAttr->nodeValue="{$stack_root}/schemas/".questionSchemaName; ! ! //Used to ensure latest schema version is used ! $schemaVersionAttr = new DOMIT_Attr('version'); ! $schemaVersionAttr->nodeValue=$stack_ver['release']; ! ! $headElement->setAttributeNode($schemaLocationAttr); ! $headElement->setAttributeNode($schemaVersionAttr); ! } ! ! function stack_xml_create_quiz_instance_header(&$headElement) ! { ! global $stack_ver, $xmlNamespaces, $stack_root; //Retrieve current release of STACK ! ! foreach ($xmlNamespaces as $namespaceKey=>$namespace) //Iterate through each namespace and add to schema header { $namespaceAttr = &new DOMIT_Attr('xmlns:'.$namespaceKey); $namespaceAttr->nodeValue=$namespace['namespace']; ! $headElement->setAttributeNode($namespaceAttr); } //Now must give location of schema from which this instance has been derived from $schemaLocationAttr = new DOMIT_Attr('xsi:noNamespaceSchemaLocation'); ! $schemaLocationAttr->nodeValue="{$stack_root}/schemas/".quizSchemaName; //Used to ensure latest schema version is used *************** *** 378,386 **** $schemaVersionAttr->nodeValue=$stack_ver['release']; ! $schemaHeader->setAttributeNode($schemaLocationAttr); ! $schemaHeader->setAttributeNode($schemaVersionAttr); ! ! return $schemaHeader; } /** --- 581,588 ---- $schemaVersionAttr->nodeValue=$stack_ver['release']; ! $headElement->setAttributeNode($schemaLocationAttr); ! $headElement->setAttributeNode($schemaVersionAttr); } + /** *************** *** 704,708 **** //Append root schema node onto DOM object and save $dom->appendChild($questionFrag); ! $success = $dom->saveXML($directory."/".$schema_file_name,true); return $success; --- 906,910 ---- //Append root schema node onto DOM object and save $dom->appendChild($questionFrag); ! $success = $dom->saveXML($directory."/".quizSchemaName,true); return $success; *************** *** 720,726 **** global $xmlElements, $stack_ver; - //File name of schema has version number of STACK clearly identified - $schema_file_name='stack_question-'.$stack_ver['release'].'.xsd'; - $dom = new DOMIT_Document(); --- 922,925 ---- *************** *** 736,740 **** //Append root schema node onto DOM object and save $dom->appendChild($questionFrag); ! $success = $dom->saveXML($directory."/".$schema_file_name,true); return $success; --- 935,939 ---- //Append root schema node onto DOM object and save $dom->appendChild($questionFrag); ! $success = $dom->saveXML($directory."/".questionSchemaName,true); return $success; |
From: pkiddie <pk...@us...> - 2005-08-10 03:36:20
|
Update of /cvsroot/stack/stack-1-0/schemas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31794/schemas Added Files: Tag: development_xmlrqp stack_question-1.0.xsd stack_quiz-1.0.xsd Removed Files: Tag: development_xmlrqp stack_question_metadata-1.0.xsd stack_quiz_metadata-1.0.xsd Log Message: Changed file name of schemas Writing out quiz XML files --- stack_quiz_metadata-1.0.xsd DELETED --- --- NEW FILE: stack_quiz-1.0.xsd --- <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2" version="1.0"> <xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd" /> <xs:import namespace="http://www.imsglobal.org/xsd/imsmd_v1p2" schemaLocation="imsmd_v1p2.xsd" /> <xs:element name="dublincore" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element ref="dc:identifier" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>This is a globally unique identifer for the question.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:title" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>The name of the question.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:description" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>The description the question.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:creator" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Shows who edited the question last.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:publisher" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>The server URL responsible for making the question available. Internal variable</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:type" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Nature of genre of content of resource. Internal variable: most likely text for question</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:format" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Digital manifestation of resource. Internal variable: most likely stackQuestion/(version number)</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:language" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>language of content of resource. User defined, maybe default to users current Windows/Linux language setting</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:rights" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Rights management statement for the resource, or reference to a service providing such information</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:date" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>An automatic time stamp showing when the question was last edited.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="lom" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element ref="lom:keyword" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Keywords, for searching over banks of questions. Note that any question with the keyword 'demo' will appear as a demo question for guest users and students to try and edit.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="lom:context" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Describes the educational context of the intended target audience of the resource. User defined list type</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="lom:difficulty" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>How difficult it is to work through the resource for the given target audience. Percieved difficulty, user defined list type</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="lom:typicallearningtime" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>An approximate time it takes to work with the resource. User defined, list type</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="stack" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="competency" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Mathematical competancies a resource trains. User defined, list type</xs:documentation> </xs:annotation> </xs:element> <xs:element name="competencylevel" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Mathematical skills a resource requires/trains. User defined, list type</xs:documentation> </xs:annotation> </xs:element> <xs:element name="excercisetype" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Type of interactive elements used in the context of the excercise. User defined, list type</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="question" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="questionVarsRaw" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This field is a string which contains a list of assignments of the form <br /> <tt> key = value </tt><br /> where each <tt>key</tt> is the name of a variable local to the question, and <tt>value</tt> is an expression in Maxima's language. When a question is instantiated, this list is passed to the CAS, and evaluated in order. The value obtained for each <tt>key</tt> will be stored and used later, for example in the question marking routines. The keys need not be unique, although only the last value will be available for use later. <p><b>Maxima's assignments <tt>a:3</tt></b><br /> Computer algebra systems each use a different syntax to denote the assignment of a value to a variable. For example, Maple and Derive use <tt>:=</tt>. Mathematica uses <tt>=</tt> or <tt>:=</tt>, depending on when the assignment is to take place. Maxima uses the form <tt>key:value</tt>, which is unusual and not intuitive. Maxima reserves <tt>:=</tt> to denote <em>function</em> definition, eg <tt>f(x):=x^2</tt>. Hence, in STACK we add an abstraction layer to enforce a syntax where every expression must be of the form <tt> key = value </tt>.</p> <p>Examples are included in the authoring guide.</p> <p><b>Notes</b> <ul> <li>Items are separated by either a newline or ;</li> <li>If you type a string not in the form <tt> key = value</tt>, a variable name such as <tt>dumvar3</tt> will be assigned automatically to keep track of the command in the list of question variables.</li> <li>These raw values are internalized as a PHP array, in this case stored in <tt>questionVars</tt>. Hence, the field may change when you edit the question.</li> <li>If a student uses a variable which has been assigned a value, the value will be used instead during the marking procedure. Hence, if you ask the student for an expression such as <tt>x^2-n</tt> in a question, it would be better not to use <tt>n</tt> here in case a student literally types this expression. </ul></p></xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionVars" minOccurs="0" maxOccurs="1" type="keyval"> <xs:annotation> <xs:documentation>This field is an array which holds the actual parsed values of the text given in the field <tt>questionVarsRaw</tt>. Internally in PHP this is stored as a numbered array, each entry of which is of the form <tt>array('key' => $var_name, 'value' => $value)</tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionStem" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is the string, ie the question, which the student actually sees. This is of the nominal data type <tt>castext</tt>, so that it may depend on the <tt>questionVars</tt>. The student will of course see the instantiated versions.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAns" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Each question must have a non-empty answer, whether or not this is actually used by the various marking schemes. This answer must be a CAS specific string, ie. it is assumed to be of type <tt>casstring</tt>. If you want the answer to be a string, use quotes, for example <tt>"hello world"</tt></xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAnsKey" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>If there are any <tt>questionPotResp</tt> in the question, which is to say a list of potential responses. This field will be used. When generating feedback to a question, based upon the student's answer, we have to refer to the student's answer using a variable name. This field allows such a local variable name to be set. All fields of the <tt>questionPotResp</tt> and the <tt>questionAnsVars</tt> may refer to this. The <tt>questionSol</tt>, that is the worked solution, may <em>not</em> refer to the student's answer. This field is required, and a default value is assigned to a blank question. This will only appear when potential responses are added.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAnsVarsRaw" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This field is treated in exactly the same way as the <tt>questionVarsRaw</tt> field above. When a student has responded to a question, this list of variables will be processed. They may depend on <ol> <li> The <tt>questionVarsInst</tt>, that is to say the instantiated question variables.</li> <li> The <tt>questionAnsKey</tt>, so that feedback may be given in terms of the student's answer.</li> </ol></xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAnsVars" minOccurs="0" maxOccurs="1" type="keyval"> <xs:annotation> <xs:documentation>See <tt>questionVars</tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionSol" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This castext is only displayed when the student asks to see the worked solution to a question. Note: the Worked solution may not depend on the <tt>questionAnsVars</tt> field</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionNote" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This allows a teacher to leave an intelligent "note to self" about which instances of variables a student has been given. The whole list of variables can be inspected, but some will only be intermediates. This is useful for giving the student a hint, or for analysis of incorrect answers.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:simpleType name="insertstars"> <xs:restriction base="xs:string"> <xs:enumeration value="TRUE" /> <xs:enumeration value="FALSE" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="informalsyntax"> <xs:restriction base="xs:string"> <xs:enumeration value="TRUE" /> <xs:enumeration value="FALSE" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="allowinputtool"> <xs:restriction base="xs:string"> <xs:enumeration value="Form box" /> <xs:enumeration value="Form box + JOME" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="display"> <xs:restriction base="xs:string"> <xs:enumeration value="String" /> <xs:enumeration value="LaTeX" /> <xs:enumeration value="MathML" /> <xs:enumeration value="LaTeX Source" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="language"> <xs:restriction base="xs:string"> <xs:enumeration value="en" /> <xs:enumeration value="es" /> <xs:enumeration value="nl" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="markmodmethod"> <xs:restriction base="xs:string"> <xs:enumeration value="Penalty" /> <xs:enumeration value="Last Answer" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="anstest"> <xs:restriction base="xs:string"> <xs:enumeration value="AlgEquiv" /> <xs:enumeration value="CASEqual" /> <xs:enumeration value="Num_tol_relative" /> <xs:enumeration value="Num_tol_absolute" /> <xs:enumeration value="String" /> <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> <xs:enumeration value="FacForm" /> <xs:enumeration value="SA_factored" /> <xs:enumeration value="SA_expanded" /> <xs:enumeration value="PartFrac" /> <xs:enumeration value="Diff" /> <xs:enumeration value="Int" /> <xs:enumeration value="SA_True" /> <xs:enumeration value="True" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="showsol"> <xs:restriction base="xs:string"> <xs:enumeration value="Always" /> <xs:enumeration value="Never" /> <xs:enumeration value="On request" /> <xs:enumeration value="After correct answer" /> </xs:restriction> </xs:simpleType> <xs:element name="questionOptions" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="InsertStars" minOccurs="0" maxOccurs="1" type="insertstars"> <xs:annotation> <xs:documentation>If set to TRUE, the system will automatically insert *'s into a student's answer, (actually any casstring) when it is validated. So, for example <tt>2(1-4x)</tt> will be changed to <tt>2*(1-4*x)</tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="InformalSyntax" minOccurs="0" maxOccurs="1" type="informalsyntax"> <xs:annotation> <xs:documentation>If set to TRUE, the system will automatically insert *'s into a student's answer, (actually any casstring) and it will not throw an error. Note however, that this is actually very hard to define robustly, since <tt> x(x+1) </tt> means apply the function <tt>x</tt> to the argument </tt>(x+1)</tt>, whereas <tt>sin(x)</tt> would be fine. How does one distinguish between the two? The system currently assumes a single letter is a variable, and otherwise this is a function to be applied. So <tt> tx(x-1) </tt> will not mean <tt> t*x*(x-1)</tt></xs:documentation> </xs:annotation> </xs:element> <xs:element name="AllowInputTool" minOccurs="0" maxOccurs="1" type="allowinputtool"> <xs:annotation> <xs:documentation>The default is just to have a form box for the student's entry. If set to 'Form box + JOME, the system will allow the use of the JOME mathematical input tool, to help student enter their answers. There are a variety of such tools, and others could easily be substituted, although it is likely an implementation needs only one. Furthermore, there will need to be javascript in the page, and so on. Hence, the file <tt>inputtool.inc</tt> and the function <tt>stack_question_inst_try_formfrag</tt> allow this to be integrated into the system. More than one input tool per implementation is not supported.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="SyntaxHint" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>A syntax hint allows the teacher to give the student a pro-forma in the input box. This can include '?' characters (which the CAS treats as the special variable <tt>qmchar</tt>). The syntax hint will appear in the answer box, whenever this is left blank by the student. For example, rather than having to type <pre>matrix([1,2],[3,4])</pre> the teacher may want to provide an answer box which already contains the string <pre>matrix([?,?],[?,?])</pre> instead. The student then need only to edit this, to replace ?'s with their values. This helps reduce syntax error problems with more difficult syntax issues. The ? may also be used to give partial credit. Of course it could also be used for general expressions such as <pre>x^2+?*x+1</pre> </xs:documentation> </xs:annotation> </xs:element> <xs:element name="Display" minOccurs="0" maxOccurs="1" type="display"> <xs:annotation> <xs:documentation>This determines how strings are displayed by the system. The <tt>String</tt> representation is exactly the CAS string. LaTeX uses the CAS's tex() function, and then passes the result through TTH. MathML is not implemented in all CAS systems. The "LaTeX Source" option generates LaTeX code, but does not process it. This can be cut and pasted into other LaTeX documents.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Language" minOccurs="0" maxOccurs="1" type="language"> <xs:annotation> <xs:documentation>This determines the language used for STACK.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="QuVal" minOccurs="0" maxOccurs="1" type="xs:float"> <xs:annotation> <xs:documentation>This is the number of marks available for the question.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="MarkModMethod" minOccurs="0" maxOccurs="1" type="markmodmethod"> <xs:annotation> <xs:documentation>This allows the teacher to specify how different marks for repeated attempts at this question are treated. The mark modification method is a function which applies to the list of raw marks, and returns a mark for this attempt. There are two mark modification methods. <ul> <li><b>Penalty</b><br /> This is the default method, which has been tried for many years using the AiM system. For each incorrect attempt, which is valid and the student asks to be marked, a penalty is accumulated. The AttemptMark is the AccumulatedPenalty for that attempt, subtracted from the RawMark. The mark for this attempt is the maximum AttemptMark. Thus a mark cannot 'go down'. This prevents a student for being penalized for continuing to try to gain credit. </li> <li><b>Last Answer</b><br /> This is the RawMark for this attempt, and disregards all penalties and previous answers. Note, this is different from setting the penalty to be zero, and using the penalty scheme above. With this method if a student leaves an incorrect answer in place they will not be given credit for any previous correct attempt. </li> </ul></xs:documentation> </xs:annotation> </xs:element> <xs:element name="Penalty" minOccurs="0" maxOccurs="1" type="xs:float"> <xs:annotation> <xs:documentation>This is the penalty applied to each different incorrect attempt, which is valid, and which the student has asked to be marked. This is subtracted from the basic question value of 1, and so must lie within the range 0 to 1, to make any sense.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Forbid" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is a comma separated list of text strings which are forbidden in a student's answer. If one of these strings is present then the student's attempt will be considered invalid, and no penalties will be given. The Forbid option works in a slightly different way from other options. The "default" values are <em>added</em> to the options entered at the question level, not over-written. So to forbid <tt>diff</tt> for a whole quiz, just set it at the quiz level. And so on. To allow a word forbidden at a higher level, use Allow.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Allow" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>See Forbid above.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="AnsTest" minOccurs="0" maxOccurs="1" type="anstest"> <xs:annotation> <xs:documentation>This determines which answer test will be applied to the pair consisting of the student's and teacher's answers. See the specific documentation.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="AnsTestOpt" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This allows an option to be passed to the <tt>AnswerTest</tt>. Not all <tt>AnswerTest</tt>'s require one. See the specific documentation. This option is considered to be a CASString, and so if non-empty must be a valid CASString.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="TeacherEmail" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is the email address that appears on the page for students to email help</xs:documentation> </xs:annotation> </xs:element> <xs:element name="FeedBackGenericCorrect" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is the string displayed to the student when their answer gets full marks, in addition to anything from the response processing tree or answer tests.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="FeedBackGenericIncorrect" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is the string displayed to the student when their answer gets full marks, in addition to anything from the response processing tree or answer tests.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="FeedBackGenericPCorrect" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is the string displayed to the student when their answer gets full marks, in addition to anything from the response processing tree or answer tests.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="ShowSol" minOccurs="0" maxOccurs="1" type="showsol"> <xs:annotation> <xs:documentation>This determines when any worked solution is available.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:simpleType name="anstest"> <xs:restriction base="xs:string"> <xs:enumeration value="AlgEquiv" /> <xs:enumeration value="CASEqual" /> <xs:enumeration value="Num_tol_relative" /> <xs:enumeration value="Num_tol_absolute" /> <xs:enumeration value="String" /> <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> <xs:enumeration value="FacForm" /> <xs:enumeration value="SA_factored" /> <xs:enumeration value="SA_expanded" /> <xs:enumeration value="PartFrac" /> <xs:enumeration value="Diff" /> <xs:enumeration value="Int" /> <xs:enumeration value="SA_True" /> <xs:enumeration value="True" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="rawmarkmod"> <xs:restriction base="xs:string"> <xs:enumeration value="=" /> <xs:enumeration value="+" /> <xs:enumeration value="-" /> <xs:enumeration value="=AT" /> </xs:restriction> </xs:simpleType> <xs:element name="questionPotResp" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="SAns" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is a CAS expression which we consider nominally to be the response of the student. The default value of this is the field <tt><font color="orange">questionAnsKey</font></tt>. The AnswerTest will be applied with this against the value in <tt><font color="orange">TAns</font></tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="TAns" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is a CAS expression which we consider nominally to be the response of the teacher. Of course, it could be the answer or a common mistake. The default value of this is the field <tt>questionAns</tt>. The AnswerTest will be applied with this against the value in <tt><font color="orange">SAns</font></tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="AnsTest" minOccurs="0" maxOccurs="1" type="anstest"> <xs:annotation> <xs:documentation>The AnswerTest to be applied to this response.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="AnsTestOpt" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>The AnswerTest Options, for this AnswerTest.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="true" minOccurs="1" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="RawMarkMod" minOccurs="0" maxOccurs="1" type="rawmarkmod"> <xs:annotation> <xs:documentation>The way in which the <tt><font color="orange">RawMark</font></tt> for this branch of the potential response is used to affect the RawMark for the attempt as a whole. It must be one of the values, =, +, - or =AT. The latter assigns the mark to be that returned by the AnswerTest, in the case where partial credit is returned.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="RawMark" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>The mark applied for this attempt, should be between 0 and 1, although does not need to be.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Penalty" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>The penalty applied for this attempt, if this branch is activated. The last such modified penalty is used. If nothing is set, then the normal penalty scheme for the question as a whole is used. This value should be either (i) between 0 and 1, (although does not need to be), or (ii) the string '' or 'default'. Basically this is a way to make sure a specific penalty is set, regardless of the mark. Useful for removing a penalty in the case of a common and silly slip.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="FeedBack" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This castext is only generated if this branch of the distracter is activated. The context in which this is evaluated is as follows: <ol> <li> <tt>questionVarsInst</tt> </li> <li> <tt>questionAnsInst</tt>, using the name given by <tt>questionAnsKey</tt> </li> <li> <tt>questionAnsVarsInst</tt> </li> </ol> This castext is then concatenated to form the FeedBack for this attempt.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="AnswerNote" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This string is added to the AnswerNote for the attempt at this question.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="ApLat" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This literally asks "Apply which later test?". It must be the number of an existing potential response. This will allow branching and the construction of tree like flow charts for the execution of feedback or partial credit. There are two provisos: <ul><li> No potential response is executed more than once. If this happens, the marking scheme bails out and takes no further action. This is to prevent loops.</li> <li> If the value of this field does not correspond to a legitimate Potential response, then the marking scheme bails out and takes no further action.</li></ul> This latter can be used to advantage by assigning the field a value of -1 to indicate the end of the process. <p> The default blank potential responses do not jump, but finish the process.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="false" minOccurs="1" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="RawMarkMod" minOccurs="0" maxOccurs="1" type="rawmarkmod"> <xs:annotation> <xs:documentation>The way in which the <tt><font color="orange">RawMark</font></tt> for this branch of the potential response is used to affect the RawMark for the attempt as a whole. It must be one of the values, =, +, - or =AT. The latter assigns the mark to be that returned by the AnswerTest, in the case where partial credit is returned.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="RawMark" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>The mark applied for this attempt, should be between 0 and 1, although does not need to be.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="Penalty" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>The penalty applied for this attempt, if this branch is activated. The last such modified penalty is used. If nothing is set, then the normal penalty scheme for the question as a whole is used. This value should be either (i) between 0 and 1, (although does not need to be), or (ii) the string '' or 'default'. Basically this is a way to make sure a specific penalty is set, regardless of the mark. Useful for removing a penalty in the case of a common and silly slip.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="FeedBack" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This castext is only generated if this branch of the distracter is activated. The context in which this is evaluated is as follows: <ol> <li> <tt>questionVarsInst</tt> </li> <li> <tt>questionAnsInst</tt>, using the name given by <tt>questionAnsKey</tt> </li> <li> <tt>questionAnsVarsInst</tt> </li> </ol> This castext is then concatenated to form the FeedBack for this attempt.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="AnswerNote" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This string is added to the AnswerNote for the attempt at this question.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="ApLat" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This literally asks "Apply which later test?". It must be the number of an existing potential response. This will allow branching and the construction of tree like flow charts for the execution of feedback or partial credit. There are two provisos: <ul><li> No potential response is executed more than once. If this happens, the marking scheme bails out and takes no further action. This is to prevent loops.</li> <li> If the value of this field does not correspond to a legitimate Potential response, then the marking scheme bails out and takes no further action.</li></ul> This latter can be used to advantage by assigning the field a value of -1 to indicate the end of the process. <p> The default blank potential responses do not jump, but finish the process.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="keyval"> <xs:sequence> <xs:element name="key" type="xs:string" /> <xs:element name="val" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:element name="assessmentItem"> <xs:complexType> <xs:all> <xs:element ref="dublincore" /> <xs:element ref="lom" /> <xs:element ref="stack" /> <xs:element ref="question" /> <xs:element ref="questionOptions" /> <xs:element ref="questionPotResp" /> </xs:all> </xs:complexType> </xs:element> <xs:element name="mathQuiz"> <xs:complexType> <xs:all> <xs:element ref="dublincore" /> <xs:element ref="lom" /> <xs:element ref="stack" /> <xs:element ref="assessmentItem" /> </xs:all> <xs:attribute name="version" use="required"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:pattern value="[1-9]+[0-9]*\.[0-9]+" /> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element> </xs:schema> --- NEW FILE: stack_question-1.0.xsd --- <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:lom="http://www.imsglobal.org/xsd/imsmd_v1p2" version="1.0"> <xs:import namespace="http://purl.org/dc/elements/1.1/" schemaLocation="dc.xsd" /> <xs:import namespace="http://www.imsglobal.org/xsd/imsmd_v1p2" schemaLocation="imsmd_v1p2.xsd" /> <xs:element name="dublincore" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element ref="dc:identifier" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>This is a globally unique identifer for the question.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:title" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>The name of the question.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:description" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>The description the question.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:creator" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Shows who edited the question last.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:publisher" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>The server URL responsible for making the question available. Internal variable</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:type" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Nature of genre of content of resource. Internal variable: most likely text for question</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:format" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Digital manifestation of resource. Internal variable: most likely stackQuestion/(version number)</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:language" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>language of content of resource. User defined, maybe default to users current Windows/Linux language setting</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:rights" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Rights management statement for the resource, or reference to a service providing such information</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="dc:date" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>An automatic time stamp showing when the question was last edited.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="lom" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element ref="lom:keyword" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Keywords, for searching over banks of questions. Note that any question with the keyword 'demo' will appear as a demo question for guest users and students to try and edit.</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="lom:context" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>Describes the educational context of the intended target audience of the resource. User defined list type</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="lom:difficulty" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>How difficult it is to work through the resource for the given target audience. Percieved difficulty, user defined list type</xs:documentation> </xs:annotation> </xs:element> <xs:element ref="lom:typicallearningtime" minOccurs="0" maxOccurs="1"> <xs:annotation> <xs:documentation>An approximate time it takes to work with the resource. User defined, list type</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="stack" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="competency" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Mathematical competancies a resource trains. User defined, list type</xs:documentation> </xs:annotation> </xs:element> <xs:element name="competencylevel" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Mathematical skills a resource requires/trains. User defined, list type</xs:documentation> </xs:annotation> </xs:element> <xs:element name="excercisetype" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Type of interactive elements used in the context of the excercise. User defined, list type</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="question" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="questionVarsRaw" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This field is a string which contains a list of assignments of the form <br /> <tt> key = value </tt><br /> where each <tt>key</tt> is the name of a variable local to the question, and <tt>value</tt> is an expression in Maxima's language. When a question is instantiated, this list is passed to the CAS, and evaluated in order. The value obtained for each <tt>key</tt> will be stored and used later, for example in the question marking routines. The keys need not be unique, although only the last value will be available for use later. <p><b>Maxima's assignments <tt>a:3</tt></b><br /> Computer algebra systems each use a different syntax to denote the assignment of a value to a variable. For example, Maple and Derive use <tt>:=</tt>. Mathematica uses <tt>=</tt> or <tt>:=</tt>, depending on when the assignment is to take place. Maxima uses the form <tt>key:value</tt>, which is unusual and not intuitive. Maxima reserves <tt>:=</tt> to denote <em>function</em> definition, eg <tt>f(x):=x^2</tt>. Hence, in STACK we add an abstraction layer to enforce a syntax where every expression must be of the form <tt> key = value </tt>.</p> <p>Examples are included in the authoring guide.</p> <p><b>Notes</b> <ul> <li>Items are separated by either a newline or ;</li> <li>If you type a string not in the form <tt> key = value</tt>, a variable name such as <tt>dumvar3</tt> will be assigned automatically to keep track of the command in the list of question variables.</li> <li>These raw values are internalized as a PHP array, in this case stored in <tt>questionVars</tt>. Hence, the field may change when you edit the question.</li> <li>If a student uses a variable which has been assigned a value, the value will be used instead during the marking procedure. Hence, if you ask the student for an expression such as <tt>x^2-n</tt> in a question, it would be better not to use <tt>n</tt> here in case a student literally types this expression. </ul></p></xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionVars" minOccurs="0" maxOccurs="1" type="keyval"> <xs:annotation> <xs:documentation>This field is an array which holds the actual parsed values of the text given in the field <tt>questionVarsRaw</tt>. Internally in PHP this is stored as a numbered array, each entry of which is of the form <tt>array('key' => $var_name, 'value' => $value)</tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionStem" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This is the string, ie the question, which the student actually sees. This is of the nominal data type <tt>castext</tt>, so that it may depend on the <tt>questionVars</tt>. The student will of course see the instantiated versions.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAns" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>Each question must have a non-empty answer, whether or not this is actually used by the various marking schemes. This answer must be a CAS specific string, ie. it is assumed to be of type <tt>casstring</tt>. If you want the answer to be a string, use quotes, for example <tt>"hello world"</tt></xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAnsKey" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>If there are any <tt>questionPotResp</tt> in the question, which is to say a list of potential responses. This field will be used. When generating feedback to a question, based upon the student's answer, we have to refer to the student's answer using a variable name. This field allows such a local variable name to be set. All fields of the <tt>questionPotResp</tt> and the <tt>questionAnsVars</tt> may refer to this. The <tt>questionSol</tt>, that is the worked solution, may <em>not</em> refer to the student's answer. This field is required, and a default value is assigned to a blank question. This will only appear when potential responses are added.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAnsVarsRaw" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This field is treated in exactly the same way as the <tt>questionVarsRaw</tt> field above. When a student has responded to a question, this list of variables will be processed. They may depend on <ol> <li> The <tt>questionVarsInst</tt>, that is to say the instantiated question variables.</li> <li> The <tt>questionAnsKey</tt>, so that feedback may be given in terms of the student's answer.</li> </ol></xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionAnsVars" minOccurs="0" maxOccurs="1" type="keyval"> <xs:annotation> <xs:documentation>See <tt>questionVars</tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionSol" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This castext is only displayed when the student asks to see the worked solution to a question. Note: the Worked solution may not depend on the <tt>questionAnsVars</tt> field</xs:documentation> </xs:annotation> </xs:element> <xs:element name="questionNote" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>This allows a teacher to leave an intelligent "note to self" about which instances of variables a student has been given. The whole list of variables can be inspected, but some will only be intermediates. This is useful for giving the student a hint, or for analysis of incorrect answers.</xs:documentation> </xs:annotation> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:simpleType name="insertstars"> <xs:restriction base="xs:string"> <xs:enumeration value="TRUE" /> <xs:enumeration value="FALSE" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="informalsyntax"> <xs:restriction base="xs:string"> <xs:enumeration value="TRUE" /> <xs:enumeration value="FALSE" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="allowinputtool"> <xs:restriction base="xs:string"> <xs:enumeration value="Form box" /> <xs:enumeration value="Form box + JOME" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="display"> <xs:restriction base="xs:string"> <xs:enumeration value="String" /> <xs:enumeration value="LaTeX" /> <xs:enumeration value="MathML" /> <xs:enumeration value="LaTeX Source" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="language"> <xs:restriction base="xs:string"> <xs:enumeration value="en" /> <xs:enumeration value="es" /> <xs:enumeration value="nl" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="markmodmethod"> <xs:restriction base="xs:string"> <xs:enumeration value="Penalty" /> <xs:enumeration value="Last Answer" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="anstest"> <xs:restriction base="xs:string"> <xs:enumeration value="AlgEquiv" /> <xs:enumeration value="CASEqual" /> <xs:enumeration value="Num_tol_relative" /> <xs:enumeration value="Num_tol_absolute" /> <xs:enumeration value="String" /> <xs:enumeration value="StringSloppy" /> <xs:enumeration value="RegExp" /> <xs:enumeration value="FacForm" /> <xs:enumeration value="SA_factored" /> <xs:enumeration value="SA_expanded" /> <xs:enumeration value="PartFrac" /> <xs:enumeration value="Diff" /> <xs:enumeration value="Int" /> <xs:enumeration value="SA_True" /> <xs:enumeration value="True" /> </xs:restriction> </xs:simpleType> <xs:simpleType name="showsol"> <xs:restriction base="xs:string"> <xs:enumeration value="Always" /> <xs:enumeration value="Never" /> <xs:enumeration value="On request" /> <xs:enumeration value="After correct answer" /> </xs:restriction> </xs:simpleType> <xs:element name="questionOptions" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence> <xs:element name="InsertStars" minOccurs="0" maxOccurs="1" type="insertstars"> <xs:annotation> <xs:documentation>If set to TRUE, the system will automatically insert *'s into a student's answer, (actually any casstring) when it is validated. So, for example <tt>2(1-4x)</tt> will be changed to <tt>2*(1-4*x)</tt>.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="InformalSyntax" minOccurs="0" maxOccurs="1" type="informalsyntax"> <xs:annotation> <xs:documentation>If set to TRUE, the system will automatically insert *'s into a student's answer, (actually any casstring) and it will not throw an error. Note however, that this is actually very hard to define robustly, since <tt> x(x+1) </tt> means apply the function <tt>x</tt> to the argument </tt>(x+1)</tt>, whereas <tt>sin(x)</tt> would be fine. How does one distinguish between the two? The system currently assumes a single letter is a variable, and otherwise this is a function to be applied. So <tt> tx(x-1) </tt> will not mean <tt> t*x*(x-1)</tt></xs:documentation> </xs:annotation> </xs:element> <xs:element name="AllowInputTool" minOccurs="0" maxOccurs="1" type="allowinputtool"> <xs:annotation> <xs:documentation>The default is just to have a form box for the student's entry. If set to 'Form box + JOME, the system will allow the use of the JOME mathematical input tool, to help student enter their answers. There are a variety of such tools, and others could easily be substituted, although it is likely an implementation needs only one. Furthermore, there will need to be javascript in the page, and so on. Hence, the file <tt>inputtool.inc</tt> and the function <tt>stack_question_inst_try_formfrag</tt> allow this to be integrated into the system. More than one input tool per implementation is not supported.</xs:documentation> </xs:annotation> </xs:element> <xs:element name="SyntaxHint" minOccurs="0" maxOccurs="1" type="xs:string"> <xs:annotation> <xs:documentation>A syntax hint allows the teacher to give the student a pro-forma in the input box. This ... [truncated message content] |