You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(486) |
Jul
(201) |
Aug
(194) |
Sep
(87) |
Oct
(72) |
Nov
(72) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(6) |
Feb
(41) |
Mar
(22) |
Apr
(4) |
May
(12) |
Jun
|
Jul
|
Aug
(42) |
Sep
(21) |
Oct
(14) |
Nov
(10) |
Dec
|
2007 |
Jan
(14) |
Feb
(34) |
Mar
(61) |
Apr
(54) |
May
(140) |
Jun
(184) |
Jul
(164) |
Aug
(130) |
Sep
(241) |
Oct
(175) |
Nov
(148) |
Dec
(96) |
2008 |
Jan
(5) |
Feb
(38) |
Mar
(30) |
Apr
(46) |
May
(25) |
Jun
(22) |
Jul
(5) |
Aug
(17) |
Sep
(2) |
Oct
(100) |
Nov
(83) |
Dec
(33) |
2009 |
Jan
(127) |
Feb
(43) |
Mar
(86) |
Apr
(34) |
May
(50) |
Jun
(168) |
Jul
(48) |
Aug
(66) |
Sep
(38) |
Oct
(75) |
Nov
(113) |
Dec
(72) |
2010 |
Jan
(123) |
Feb
(68) |
Mar
(26) |
Apr
(11) |
May
(39) |
Jun
(131) |
Jul
(56) |
Aug
(79) |
Sep
(69) |
Oct
(17) |
Nov
(166) |
Dec
(32) |
2011 |
Jan
(21) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(1) |
Nov
(8) |
Dec
|
2012 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Chris S. <san...@us...> - 2005-09-01 08:17:33
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31035/scripts Modified Files: stackUtility.php Log Message: Added "equation" and "inequality" input types to the AlgEquiv Answer test. Index: stackUtility.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUtility.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** stackUtility.php 29 Aug 2005 15:35:23 -0000 1.32 --- stackUtility.php 1 Sep 2005 08:13:57 -0000 1.33 *************** *** 476,479 **** --- 476,485 ---- } + if (strstr($strin,'=>') or strstr($strin,'=<') + or strstr($strin,'> =') or strstr($strin,'< =') + or strstr($strin,'= >') or strstr($strin,'= <')) { + $ret .= '<br />'.get_string('BadIneqs','stack',''); + } + // (4.2) Check for |'s (there should be none!) if (strstr($strin,'|')) { |
From: Chris S. <san...@us...> - 2005-09-01 08:14:10
|
Update of /cvsroot/stack/stack-1-0/scripts/maxima In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31035/scripts/maxima Modified Files: stackmaxima.mac Log Message: Added "equation" and "inequality" input types to the AlgEquiv Answer test. Index: stackmaxima.mac =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/maxima/stackmaxima.mac,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** stackmaxima.mac 29 Aug 2005 16:33:55 -0000 1.29 --- stackmaxima.mac 1 Sep 2005 08:13:57 -0000 1.30 *************** *** 280,283 **** --- 280,297 ---- RETURN(ret) )$ + /* Determines if we are using an equation */ + equationp(ex) := BLOCK( + if atom(ex) then RETURN(FALSE), + if "="= op(ex) then RETURN(TRUE), + RETURN(FALSE) + ); + + /* Determines if we are using an equation */ + inequalityp(ex) := BLOCK( + if atom(ex) then RETURN(FALSE), + if ">"= op(ex) or "<"= op(ex) or ">="= op(ex) or "<="= op(ex)then RETURN(TRUE), + RETURN(FALSE) + ); + /* commonfac(l) returns the hcf of a list of numbers */ commonfaclist(l) := BLOCK([i,a,ret], *************** *** 329,333 **** if matrixp(SB) then if matrixp(SA)#TRUE then ! return(StackReturnOb("false","0","ATAlgEquiv_SA_notmatrix",StackAddFeedback("","ATAlgEquiv_SA_notmatrix"))) else return(ATMatrix(SA,SB)), --- 343,347 ---- if matrixp(SB) then if matrixp(SA)#TRUE then ! return(StackReturnOb("false","0","ATAlgEquiv_SA_not_matrix",StackAddFeedback("","ATAlgEquiv_SA_not_matrix"))) else return(ATMatrix(SA,SB)), *************** *** 335,341 **** if listp(SB) then if listp(SA)#TRUE then ! return(StackReturnOb("false","0","ATAlgEquiv_SA_notlist",StackAddFeedback("","ATAlgEquiv_SA_notlist"))) else return(ATList(SA,SB)), /* Are we dealing with lists? */ if setp(SB) then --- 349,367 ---- if listp(SB) then if listp(SA)#TRUE then ! return(StackReturnOb("false","0","ATAlgEquiv_SA_not_list",StackAddFeedback("","ATAlgEquiv_SA_not_list"))) else return(ATList(SA,SB)), + /* Are we dealing with an equation? */ + if equationp(SB) then + if equationp(SA)#TRUE then + return(StackReturnOb("false","0","ATAlgEquiv_SA_not_equation",StackAddFeedback("","ATAlgEquiv_SA_not_equation"))) + else + return(ATEquation(SA,SB)), + /* Are we dealing with an equation? */ + if inequalityp(SB) then + if inequalityp(SA)#TRUE then + return(StackReturnOb("false","0","ATAlgEquiv_SA_not_inequality",StackAddFeedback("","ATAlgEquiv_SA_not_inequality"))) + else + return(ATInequality(SA,SB)), /* Are we dealing with lists? */ if setp(SB) then *************** *** 391,394 **** --- 417,451 ---- )$ + ATEquation(SA,SB):= + BLOCK([RawMark,SA1,SB1,SB2], + RawMark:0, + SB1:rhs(SB)-lhs(SB), + SB2:lhs(SB)-rhs(SB), + SA1:rhs(SA)-lhs(SA), + if Stack_Test(SA1,SB1) or Stack_Test(SA1,SB2) then + RawMark:1, + RETURN(StackReturnOb("true",STRING(RawMark),"","")) + )$ + + ATInequality(SA,SB):= + BLOCK([RawMark,SA1,SB1], + RawMark:0, + SA1:1, + SB1:0, + if op(SA)=op(SB) then ( + SA1:part(SA,1)-part(SA,2), + SB1:part(SB,1)-part(SB,2) + ), + if (op(SA)=">" and op(SB)="<") or (op(SA)="<" and op(SB)=">") or + (op(SA)=">=" and op(SB)="<=") or (op(SA)="<=" and op(SB)=">=") then ( + SA1:part(SA,1)-part(SA,2), + SB1:part(SB,2)-part(SB,1) + ), + if Stack_Test(SA1,SB1) then + RawMark:1, + RETURN(StackReturnOb("true",STRING(RawMark),"","")) + )$ + + /* An answer test based on two matrices for SA and SB */ ATMatrix(SA,SB):= |
From: Chris S. <san...@us...> - 2005-08-30 18:30:27
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18899/scripts Modified Files: stackAuthor.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** stackAuthor.php 30 Aug 2005 16:34:58 -0000 1.36 --- stackAuthor.php 30 Aug 2005 18:30:19 -0000 1.37 *************** *** 15,18 **** --- 15,32 ---- /** + * + * @param string $fieldname The field name + * @return string The link to the popup window + */ + function stack_question_edit_formname($fieldname,$prefix) { + + if ('' == $prefix) { + return $fieldname; + } + $fieldname = $prefix.'['.$fieldname.']'; + return $fieldname; + } + + /** * Display the name of a option field, in a link generating a popup window. * Added $remoteCaller, which if not specified defaults to false. This prevents the display of the help *************** *** 24,39 **** global $stackOptions; ! $fd='stackOptions_'.$field; ! $fd=get_string($fd,'stack',''); ! ! if (!$remoteCaller) ! { ! $strout = "<a href=\"javascript:HelpPopup('$field','stackOptions');\">$fd</a>"; ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackOptions');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); ! } ! else if ($remoteCaller) { ! return($fd); } } --- 38,50 ---- global $stackOptions; ! $fd = 'stackOptions_'.$field; ! $fd = get_string($fd,'stack',''); ! if ($remoteCaller) { ! return($fd); ! } else { ! $strout = "<a href=\"javascript:HelpPopup('$field','stackOptions');\">$fd</a>"; ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackOptions');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); } } *************** *** 80,84 **** * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname,$remoteCaller=FALSE) { global $stackOptions; --- 91,95 ---- * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname,$prefix='',$remoteCaller=FALSE) { global $stackOptions; *************** *** 90,94 **** foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt,$remoteCaller); ! $name = $fieldname.'['.$opt.']'; $category = $options_headings[$k]; echo "\n<tr>\n"; --- 101,105 ---- foreach( $options_list as $k => $opt) { $descript = stack_question_edit_dispoptionfield($opt,$remoteCaller); ! $name = stack_question_edit_formname($fieldname,$prefix).'['.$opt.']'; $category = $options_headings[$k]; echo "\n<tr>\n"; *************** *** 194,223 **** // hidden metadata ! echo "\n<hr />\n ! <input type='hidden' name='questionID' value='".sf($question,'questionID')."' />\n ! <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n ! <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionUserLastEdited' value='".sf($question,'questionUserLastEdited')."' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='type' value='".sf($question,'type')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! ! <table cellboarder='0' cellpadding='2'> ! <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> ! <td><input type='input' name='questionName' value='".sf($question,'questionName')."' size='25' /> (ID: ".sf($question,'questionID').") </td> </tr> ! <tr> <td>".get_string('stackQuestion_questionDescription','stack','').":</td> ! <td><input type='input' name='questionDescription' value='".sf($question,'questionDescription')."' size='60' /></tr> ! <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> ! <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> ! ! </table> "; ! // HACK: the field type in the database does not ! // allow these to be edited yet. ! // <tr> <td> Last edited by: </td> ! // <td> <input type='input' name='questionUserLastEdited' value='".stack_s($question['questionUserLastEdited'])."' size='40' /> on $dts.</td> ! // </tr> ! echo "\n<hr />\n"; // Buttons to go somewhere next --- 205,233 ---- // hidden metadata ! $hidden_metadata = array('questionID','questionGUID','questionDateLastEdited','questionUserLastEdited','questionPublisher','type','questionFormat'); ! foreach ($hidden_metadata as $val) { ! $name = stack_question_edit_formname($val,$prefix); ! echo "<input type='hidden' name='$name' value='".sf($question,$val)."' />\n"; ! } ! ! echo "\n<hr />\n\n<table cellboarder='0' cellpadding='2'>\n"; ! ! $val = 'questionName'; ! $sz = 25; ! $name = stack_question_edit_formname($val,$prefix); ! echo "<tr>\n <td>".get_string("stackQuestion_$val",'stack','').":</td>\n <td><input type='input' name='$name' value='".sf($question,$val)."' size='$sz' />"; ! echo " (ID: ".sf($question,'questionID').") </td>\n</tr>\n"; ! $val = 'questionDescription'; ! $sz = 60; ! $name = stack_question_edit_formname($val,$prefix); ! echo "<tr>\n <td>".get_string("stackQuestion_$val",'stack','').":</td>\n <td><input type='input' name='$name' value='".sf($question,$val)."' size='$sz' /> </td>\n</tr>\n"; ! $val = 'questionKeywords'; ! $sz = 60; ! $name = stack_question_edit_formname($val,$prefix); ! echo "<tr>\n <td>".get_string("stackQuestion_$val",'stack','').":</td>\n <td><input type='input' name='$name' value='".sf($question,$val)."' size='$sz' /> </td>\n</tr>\n"; ! ! echo "</table>\n\n<hr />\n"; // Buttons to go somewhere next *************** *** 243,252 **** $strout = str_replace(";","\n",$question[$qfield]); } else { $strout = ''; } ! stack_question_edit_form_field($qfield,$strout,$errors); echo "\n\n<br />\n"; $qfield='questionStem'; echo "<b>".stack_question_edit_dispquestionfield($qfield,$remoteCaller)."</b><br />"; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "<p><table align=top><tr align=top>\n"; --- 253,262 ---- $strout = str_replace(";","\n",$question[$qfield]); } else { $strout = ''; } ! stack_question_edit_form_field($qfield,$strout,$prefix,$errors); echo "\n\n<br />\n"; $qfield='questionStem'; echo "<b>".stack_question_edit_dispquestionfield($qfield,$remoteCaller)."</b><br />"; ! @stack_question_edit_form_field($qfield,$question[$qfield],$prefix,$errors); echo "<p><table align=top><tr align=top>\n"; *************** *** 255,259 **** echo "<td> </td></tr>\n\n<tr align=top>\n <td align=top>"; $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "</td>\n <td> </td></tr>"; } else { --- 265,269 ---- echo "<td> </td></tr>\n\n<tr align=top>\n <td align=top>"; $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$prefix,$errors); echo "</td>\n <td> </td></tr>"; } else { *************** *** 266,280 **** $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "</td>\n <td align=top>\n"; $opt = 'AnsTest'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); echo "</td>\n <td align=top>\n"; $opt = 'AnsTestOpt'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt],20); echo "</td>\n</tr>"; --- 276,290 ---- $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$prefix,$errors); echo "</td>\n <td align=top>\n"; $opt = 'AnsTest'; ! $opt_name = stack_question_edit_formname('questionOptions',$prefix).'['.$opt.']'; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt],$prefix); echo "</td>\n <td align=top>\n"; $opt = 'AnsTestOpt'; ! $opt_name = stack_question_edit_formname('questionOptions',$prefix).'['.$opt.']'; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt],$prefix,20); echo "</td>\n</tr>"; *************** *** 290,299 **** $opt = 'QuVal'; ! $opt_name = "questionOptions[{$opt}]"; @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); echo " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; $opt = 'Penalty'; ! $opt_name = "questionOptions[{$opt}]"; @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); echo " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; --- 300,309 ---- $opt = 'QuVal'; ! $opt_name = stack_question_edit_formname('questionOptions',$prefix).'['.$opt.']'; @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); echo " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; $opt = 'Penalty'; ! $opt_name = stack_question_edit_formname('questionOptions',$prefix).'['.$opt.']'; @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); echo " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; *************** *** 303,312 **** // Potential responses if ($remoteCaller) { ! echo "Add \n"; } else { echo "<br /><a href=\"javascript:EditQ('edit')\">Edit</a> and add \n"; } ! echo '<input type="input" name="questionPotResp[add]" value="0" size="3" />'; ! echo " potential responses<a href=\"javascript:HelpPopup('all','author_potresp');\"><img align=\"middle\" border=\"0\" height=\"17\" width=\"17\" src=\"pics/help.gif\" /></a> (distractors etc).<br />"; if (array_key_exists('questionPotResp',$question)) { --- 313,327 ---- // Potential responses if ($remoteCaller) { ! echo "Add \n"; } else { echo "<br /><a href=\"javascript:EditQ('edit')\">Edit</a> and add \n"; } ! $name = stack_question_edit_formname('questionPotResp',$prefix).'[add]'; ! echo "<input type='input' name='$name' value='0' size='3' />"; ! echo " potential responses (distractors etc). "; ! if (!$remoteCaller) { ! echo "<a href=\"javascript:HelpPopup('all','author_potresp');\"><img align=\"middle\" border=\"0\" height=\"17\" width=\"17\" src=\"pics/help.gif\" /></a>"; ! } ! echo "<br />"; if (array_key_exists('questionPotResp',$question)) { *************** *** 315,319 **** $qfield='questionAnsKey'; echo '<p><b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo '</p>'; --- 330,334 ---- $qfield='questionAnsKey'; echo '<p><b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$prefix,$errors); echo '</p>'; *************** *** 325,329 **** $strout = str_replace(";","\n",$question[$qfield]); } ! @stack_question_edit_form_field($qfield,$strout,$errors); echo "\n\n<br />\n"; --- 340,344 ---- $strout = str_replace(";","\n",$question[$qfield]); } ! @stack_question_edit_form_field($qfield,$strout,$prefix,$errors); echo "\n\n<br />\n"; *************** *** 332,336 **** foreach ($question['questionPotResp'] as $key => $potresp) { $potresp['order']=$key; ! @stack_question_edit_potresp($key,$potresp,$npr,$errors); } echo '</p>'; --- 347,351 ---- foreach ($question['questionPotResp'] as $key => $potresp) { $potresp['order']=$key; ! @stack_question_edit_potresp($key,$potresp,$npr,$errors,$prefix,$remoteCaller); } echo '</p>'; *************** *** 338,352 **** } // end questionPotResp } else { // This needs its default, non-empty value. ! echo "<input type='hidden' name='questionAnsKey' value='".stack_s($question['questionAnsKey'])."' />\n"; } $qfield='questionSol'; echo '<b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "\n\n<br />\n"; $qfield='questionNote'; echo '<b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "\n\n<br />\n"; --- 353,368 ---- } // end questionPotResp } else { // This needs its default, non-empty value. ! $name = stack_question_edit_formname('questionAnsKey',$prefix); ! echo "<input type='hidden' name='$name' value='".stack_s($question['questionAnsKey'])."' />\n"; } $qfield='questionSol'; echo '<b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$prefix,$errors); echo "\n\n<br />\n"; $qfield='questionNote'; echo '<b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$prefix,$errors); echo "\n\n<br />\n"; *************** *** 368,372 **** $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); ! stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$remoteCaller); echo "\n<hr />\n"; --- 384,388 ---- $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); ! stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$prefix,$remoteCaller); echo "\n<hr />\n"; *************** *** 375,379 **** $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); ! stack_question_metadata_edit_form($question,$metadata_list,$remoteCaller); //Create all metadata fields on question form echo "\n<hr />\n"; --- 391,395 ---- $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); ! stack_question_metadata_edit_form($question,$metadata_list,$prefix,$remoteCaller); //Create all metadata fields on question form echo "\n<hr />\n"; *************** *** 382,391 **** if (!$remoteCaller) { ! ob_end_flush(); } //Do not ask server to display options, waste of processor power else { ! ob_end_clean(); } --- 398,407 ---- if (!$remoteCaller) { ! ob_end_flush(); } //Do not ask server to display options, waste of processor power else { ! ob_end_clean(); } *************** *** 402,417 **** * @return void */ ! function stack_question_edit_form_field($f,$qf,$errors) { // Output an element on the form. global $stackQuestion; $val = $stackQuestion[$f]; // htmlspecialchars $qf = stack_s($qf); if ('castext' == $val['type']) { // Adjust the size of the box! $rows = substr_count($qf,"\n") + 2; ! echo "<textarea name=\"$f\" cols=\"60\" rows=\"$rows\">$qf</textarea>\n"; if ($errors) { if (array_key_exists($f,$errors)) { --- 418,435 ---- * @return void */ ! function stack_question_edit_form_field($f,$qf,$prefix,$errors) { // Output an element on the form. global $stackQuestion; + $val = $stackQuestion[$f]; // htmlspecialchars $qf = stack_s($qf); + $name = stack_question_edit_formname($f,$prefix); if ('castext' == $val['type']) { // Adjust the size of the box! $rows = substr_count($qf,"\n") + 2; ! echo "<textarea name=\"$name\" cols=\"60\" rows=\"$rows\">$qf</textarea>\n"; if ($errors) { if (array_key_exists($f,$errors)) { *************** *** 423,427 **** // Adjust the size of the box! $rows = substr_count($qf,"\n") + 2; ! echo "<textarea name='$f' cols='60' rows='$rows'>$qf</textarea>\n"; if (is_array($errors)) { --- 441,445 ---- // Adjust the size of the box! $rows = substr_count($qf,"\n") + 2; ! echo "<textarea name='$name' cols='60' rows='$rows'>$qf</textarea>\n"; if (is_array($errors)) { *************** *** 436,440 **** } else if ( 'casstring' == $val['type'] or 'string'== $val['type']) { ! echo "<input type='text' name='$f' size='30' value ='$qf'/>\n"; if ('' != $errors[$f]) { --- 454,458 ---- } else if ( 'casstring' == $val['type'] or 'string'== $val['type']) { ! echo "<input type='text' name='$name' size='30' value ='$qf'/>\n"; if ('' != $errors[$f]) { *************** *** 460,470 **** if(!$remoteCaller) { ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuestion');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); } else { ! return($fd); } } --- 478,488 ---- if(!$remoteCaller) { ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuestion');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); } else { ! return($fd); } } *************** *** 479,496 **** * @return void */ ! function stack_question_edit_potresp($key,$potresp,$npr,&$errors) { echo "<table border='1'><tr align=top><td>\n"; echo "\n\n<table border='0' cellpadding='2'>\n"; echo "<tr>\n <td>No.</td>\n <td></td>\n ! <td><a href=\"javascript:HelpPopup('SAns','stackQuestionPotResp');\">".get_string('stackQuestion_PR_SAns2','stack')."</a></td>\n ! <td><a href=\"javascript:HelpPopup('TAns','stackQuestionPotResp');\">".get_string('stackQuestion_PR_TAns2','stack')."</a></td>\n ! <td><a href=\"javascript:HelpPopup('AnsTest','stackOptions');\">".get_string('stackQuestion_PR_AnsTest','stack')."</a></td>\n ! <td><a href=\"javascript:HelpPopup('AnsTestOpt','stackOptions');\">".get_string('stackQuestion_PR_AnsTestOpts','stack')."</a></td> <td>Del</td>\n </tr>\n"; ! $name = "questionPotResp[$key]"; echo "\n<tr align=top>\n"; --- 497,528 ---- * @return void */ ! function stack_question_edit_potresp($key,$potresp,$npr,&$errors,$prefix,$remoteCaller) { + $helplogo = "<img align=\"middle\" border=\"0\" height=\"17\" width=\"17\" src=\"pics/help.gif\" />"; + echo "<table border='1'><tr align=top><td>\n"; echo "\n\n<table border='0' cellpadding='2'>\n"; + if ($remoteCaller) { echo "<tr>\n <td>No.</td>\n <td></td>\n ! <td>".get_string('stackQuestion_PR_SAns2','stack')."</td>\n ! <td>".get_string('stackQuestion_PR_TAns2','stack')."</td>\n ! <td>".get_string('stackQuestion_PR_AnsTest','stack')."</td>\n ! <td>".get_string('stackQuestion_PR_AnsTestOpts','stack')."</td> <td>Del</td>\n </tr>\n"; + + } else { + echo "<tr>\n <td>No.</td>\n + <td></td>\n + <td><a href=\"javascript:HelpPopup('SAns','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_SAns2','stack')."</td>\n + <td><a href=\"javascript:HelpPopup('TAns','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_TAns2','stack')."</td>\n + <td><a href=\"javascript:HelpPopup('AnsTest','stackOptions');\">$helplogo</a> ".get_string('stackQuestion_PR_AnsTest','stack')."</td>\n + <td><a href=\"javascript:HelpPopup('AnsTestOpt','stackOptions');\">$helplogo</a> ".get_string('stackQuestion_PR_AnsTestOpts','stack')."</td> + <td>Del</td>\n + </tr>\n"; + } ! $name = stack_question_edit_formname('questionPotResp',$prefix).'['.$key.']'; echo "\n<tr align=top>\n"; *************** *** 501,505 **** stack_question_edit_input_stringfield($name,$potresp,'TAns',-4,10); ! $field = $name.'[AnsTest]'; $val = $potresp['AnsTest']; echo ' <td>'; --- 533,537 ---- stack_question_edit_input_stringfield($name,$potresp,'TAns',-4,10); ! $field = $name.'[AnsTest]'; $val = $potresp['AnsTest']; echo ' <td>'; *************** *** 528,538 **** } ! echo "<tr align=top><td>If...</td>\n ! <td><a href=\"javascript:HelpPopup('RawMarkMod','stackQuestionPotResp');\">".get_string('stackQuestion_PR_RawMarkMod2','stack')."</a></td>\n ! <td><a href=\"javascript:HelpPopup('RawMark','stackQuestionPotResp');\">".get_string('Score','stack')."</a></td>\n ! <td><a href=\"javascript:HelpPopup('Penalty','stackQuestionPotResp');\">".get_string('stackQuestion_PR_Penalty','stack')."</a></td>\n ! <td colspan='2'><a href=\"javascript:HelpPopup('FeedBack','stackQuestionPotResp');\">".get_string('stackQuestion_PR_FeedBack','stack')."</a></td>\n ! <td><a href=\"javascript:HelpPopup('ApLat','stackQuestionPotResp');\">".get_string('stackQuestion_PR_ApLat2','stack')."</a></td>\n"; ! echo "<td></td></tr>\n"; echo ' <td>true</td>'; --- 560,580 ---- } ! if ($remoteCaller) { ! echo "<tr align=top><td>If...</td>\n ! <td>".get_string('stackQuestion_PR_RawMarkMod2','stack')."</td>\n ! <td>".get_string('Score','stack')."</td>\n ! <td>".get_string('stackQuestion_PR_Penalty','stack')."</td>\n ! <td colspan='2'>".get_string('stackQuestion_PR_FeedBack','stack')."</td>\n ! <td>>".get_string('stackQuestion_PR_ApLat2','stack')."</td>\n"; ! echo "<td></td></tr>\n"; ! } else { ! echo "<tr align=top><td>If...</td>\n ! <td><a href=\"javascript:HelpPopup('RawMarkMod','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_RawMarkMod2','stack')."</td>\n ! <td><a href=\"javascript:HelpPopup('RawMark','stackQuestionPotResp');\">$helplogo</a> ".get_string('Score','stack')."</td>\n ! <td><a href=\"javascript:HelpPopup('Penalty','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_Penalty','stack')."</td>\n ! <td colspan='2'><a href=\"javascript:HelpPopup('FeedBack','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_FeedBack','stack')."</td>\n ! <td><a href=\"javascript:HelpPopup('ApLat','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_ApLat2','stack')."</td>\n"; ! echo "<td></td></tr>\n"; ! } echo ' <td>true</td>'; *************** *** 554,558 **** } ! echo "<tr><td></td> <td></td><td align ='right' colspan='2'><a href=\"javascript:HelpPopup('AnswerNote','stackQuestionPotResp');\">AnswerNote</a></td>"; $strin = $potresp['true']['AnswerNote']; stack_question_edit_input_textfield($bname,$strin,'AnswerNote',55,3); --- 596,606 ---- } ! echo "<tr><td></td> <td></td><td align ='right' colspan='2'>"; ! if ($remoteCaller) { ! echo get_string('stackQuestion_PR_AnswerNote','stack'); ! } else { ! echo "<a href=\"javascript:HelpPopup('AnswerNote','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_AnswerNote','stack'); ! } ! echo "</td>"; $strin = $potresp['true']['AnswerNote']; stack_question_edit_input_textfield($bname,$strin,'AnswerNote',55,3); *************** *** 589,593 **** } ! echo "<tr><td></td> <td></td><td align ='right' colspan='2'><a href=\"javascript:HelpPopup('AnswerNote','stackQuestionPotResp');\">AnswerNote</a></td>"; $strin = $potresp['false']['AnswerNote']; stack_question_edit_input_textfield($bname,$strin,'AnswerNote',55,3); --- 637,647 ---- } ! echo "<tr><td></td> <td></td><td align ='right' colspan='2'>"; ! if ($remoteCaller) { ! echo get_string('stackQuestion_PR_AnswerNote','stack'); ! } else { ! echo "<a href=\"javascript:HelpPopup('AnswerNote','stackQuestionPotResp');\">$helplogo</a> ".get_string('stackQuestion_PR_AnswerNote','stack'); ! } ! echo "</td>"; $strin = $potresp['false']['AnswerNote']; stack_question_edit_input_textfield($bname,$strin,'AnswerNote',55,3); *************** *** 653,657 **** * @return void */ ! function stack_question_edit_potresp_branch($name,$branchvals,$npr) { $field = $name.'[RawMarkMod]'; --- 707,711 ---- * @return void */ ! function stack_question_edit_potresp_branch($name,$branchvals,$npr,$prefix) { $field = $name.'[RawMarkMod]'; *************** *** 713,717 **** */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! //show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; --- 767,771 ---- */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! //show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; *************** *** 772,778 **** $options_headings = array('',''); $options_list = array('QuizMode','TeacherEmail'); ! $fieldname = 'quiz[quizOptions]'; ! ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname); --- 826,833 ---- $options_headings = array('',''); $options_list = array('QuizMode','TeacherEmail'); ! ! // If there is a prefix sort it out *HERE!* ! $fieldname = 'quiz'.'[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,''); *************** *** 814,820 **** $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','Language'); - $fieldname = 'quiz[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname); // Check if quiz has metadata set --- 869,875 ---- $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','Language'); ! $fieldname = 'quiz'.'[quizOptions]'; ! stack_options_edit_form($options_headings,$options_list,$optval,$fieldname,$prefix); // Check if quiz has metadata set *************** *** 1004,1008 **** * @return void */ ! function stack_question_metadata_edit_form($question,$metadata_list,$remoteCaller=FALSE) { global $stackQuestion; --- 1059,1063 ---- * @return void */ ! function stack_question_metadata_edit_form($question,$metadata_list,$prefix='',$remoteCaller=FALSE) { global $stackQuestion; *************** *** 1017,1021 **** foreach( $metadata_list as $k => $metadata) { $descript = stack_question_edit_dispquestionfield($metadata,$remoteCaller); //Display tag with help ! $fieldname= $metadata; echo " <td> $descript </td>\n <td>"; --- 1072,1076 ---- foreach( $metadata_list as $k => $metadata) { $descript = stack_question_edit_dispquestionfield($metadata,$remoteCaller); //Display tag with help ! $fieldname = stack_question_edit_formname($metadata,$prefix); echo " <td> $descript </td>\n <td>"; |
From: pkiddie <pk...@us...> - 2005-08-30 16:35:10
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25387/scripts Modified Files: stackAuthor.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** stackAuthor.php 30 Aug 2005 14:39:21 -0000 1.35 --- stackAuthor.php 30 Aug 2005 16:34:58 -0000 1.36 *************** *** 302,306 **** // Potential responses ! echo "<br /><a href=\"javascript:EditQ('edit')\">Edit</a> and add \n"; echo '<input type="input" name="questionPotResp[add]" value="0" size="3" />'; echo " potential responses<a href=\"javascript:HelpPopup('all','author_potresp');\"><img align=\"middle\" border=\"0\" height=\"17\" width=\"17\" src=\"pics/help.gif\" /></a> (distractors etc).<br />"; --- 302,310 ---- // Potential responses ! if ($remoteCaller) { ! echo "Add \n"; ! } else { ! echo "<br /><a href=\"javascript:EditQ('edit')\">Edit</a> and add \n"; ! } echo '<input type="input" name="questionPotResp[add]" value="0" size="3" />'; echo " potential responses<a href=\"javascript:HelpPopup('all','author_potresp');\"><img align=\"middle\" border=\"0\" height=\"17\" width=\"17\" src=\"pics/help.gif\" /></a> (distractors etc).<br />"; |
From: pkiddie <pk...@us...> - 2005-08-30 16:35:10
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25387/scripts/rqp Modified Files: RQPv1p0Server.php nb_soapfuncs.php Log Message: Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RQPv1p0Server.php 30 Aug 2005 10:28:01 -0000 1.3 --- RQPv1p0Server.php 30 Aug 2005 16:34:57 -0000 1.4 *************** *** 2,7 **** include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); ! include("../../stackstd.php"); //include("rqp_util.php"); //Stack/RQP utility function. /********* Data structures used by this web service ********* --- 2,9 ---- include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); ! //include("../../stackstd.php"); //include("rqp_util.php"); //Stack/RQP utility function. + include("../../stackConfig.php"); + include("../../stackLib.php"); /********* Data structures used by this web service ********* *************** *** 52,56 **** /* You need to tell STACK where it is, to create accurate URL's */ $stack_host = 'localhost'; ! $stack_basepath = 'stack-1-0'; /* The URL of the site, with trailing slash */ /* (You should not need to edit below) */ --- 54,58 ---- /* You need to tell STACK where it is, to create accurate URL's */ $stack_host = 'localhost'; ! $stack_basepath = 'stack-1-0-dev_rqp'; /* The URL of the site, with trailing slash */ /* (You should not need to edit below) */ *************** *** 210,214 **** function RQP_ServerInformation() { ! include("../../stackstd.php"); //Reqd for version info for STACK global $stack_ver, $stack_web_url, $stack_web_services_provide; --- 212,216 ---- function RQP_ServerInformation() { ! //include("../../stackstd.php"); //Reqd for version info for STACK global $stack_ver, $stack_web_url, $stack_web_services_provide; *************** *** 387,391 **** $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_question_edit_form_substance($question,&$errors, $namePrefix, TRUE), 'stem' => '', 'feedback' => '', --- 389,393 ---- $output = array('title' => '', //initially question will have no title //remoteCaller = true ! 'body' => stack_question_edit_form_substance($question,$errors, $namePrefix, TRUE), 'stem' => '', 'feedback' => '', Index: nb_soapfuncs.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/nb_soapfuncs.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** nb_soapfuncs.php 30 Aug 2005 10:28:01 -0000 1.3 --- nb_soapfuncs.php 30 Aug 2005 16:34:57 -0000 1.4 *************** *** 73,77 **** stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) --- 73,77 ---- stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) *************** *** 139,143 **** fclose($sock); } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } --- 139,143 ---- fclose($sock); } ! echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } *************** *** 159,163 **** $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) --- 159,163 ---- $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); ! echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) *************** *** 174,178 **** fclose($sock); } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; --- 174,178 ---- fclose($sock); } ! echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; |
From: Chris S. <san...@us...> - 2005-08-30 14:47:01
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30617/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** stackDatabase.php 30 Aug 2005 14:29:25 -0000 1.38 --- stackDatabase.php 30 Aug 2005 14:46:54 -0000 1.39 *************** *** 1190,1195 **** $user = FALSE; $stackUserKeys = array_keys($stackUser); ! ! $query = "SELECT * FROM stackUser WHERE username = '$username'"; $result = stack_db_query($query); --- 1190,1199 ---- $user = FALSE; $stackUserKeys = array_keys($stackUser); ! ! foreach ($stackUserKeys as $val) { ! $query .= ' ,'.$val; ! } ! $query = substr($query,2,strlen($query)-2); ! $query = "SELECT $query FROM stackUser WHERE username = '$username'"; $result = stack_db_query($query); *************** *** 1384,1391 **** $quiz_list = NULL; $quiz_fields = array_keys($stackQuiz); if ('' == $quizid) { ! $query = "SELECT * FROM stackQuiz"; } else { ! $query = "SELECT * FROM stackQuiz WHERE quizid = '$quizid'"; } $result = stack_db_query($query); --- 1388,1401 ---- $quiz_list = NULL; $quiz_fields = array_keys($stackQuiz); + + foreach ($quiz_fields as $val) { + $query .= ' ,'.$val; + } + $query = substr($query,2,strlen($query)-2); + if ('' == $quizid) { ! $query = "SELECT $query FROM stackQuiz"; } else { ! $query = "SELECT $query FROM stackQuiz WHERE quizid = '$quizid'"; } $result = stack_db_query($query); *************** *** 1530,1544 **** * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! ! * @param int $qord The order of the question in the quiz, optional * @return void */ function stack_db_quiz_add_question($quizid,$questionID,$qord='NULL') { ! if ($qord==='NULL') $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; ! ! else ! $query = "INSERT INTO quiz_question (quizid, questionID, qord) VALUES ('$quizid','$questionID','$qord')"; ! $result = stack_db_query($query); } --- 1540,1554 ---- * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! ! * @param int $qord The order of the question in the quiz, optional * @return void */ function stack_db_quiz_add_question($quizid,$questionID,$qord='NULL') { ! if ($qord==='NULL') $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; ! ! else ! $query = "INSERT INTO quiz_question (quizid, questionID, qord) VALUES ('$quizid','$questionID','$qord')"; ! $result = stack_db_query($query); } |
From: pkiddie <pk...@us...> - 2005-08-30 14:39:32
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28526/scripts Modified Files: stackAuthor.php Log Message: Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** stackAuthor.php 30 Aug 2005 13:51:54 -0000 1.34 --- stackAuthor.php 30 Aug 2005 14:39:21 -0000 1.35 *************** *** 710,714 **** function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; --- 710,714 ---- function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! //show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; |
From: pkiddie <pk...@us...> - 2005-08-30 14:39:29
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28526 Modified Files: import.php Log Message: Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/import.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** import.php 30 Aug 2005 13:51:54 -0000 1.8 --- import.php 30 Aug 2005 14:39:21 -0000 1.9 *************** *** 279,283 **** echo "<td><font color=\"greed\">Valid question</font></td>"; - show_array($key); //For each valid question we must also add the question to the database stack_db_quiz_add_question($quiz['quizid'],$qu['questionID'],$key); //For each question, add link from quiz to question --- 279,282 ---- |
From: Chris S. <san...@us...> - 2005-08-30 14:29:35
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25899/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** stackDatabase.php 30 Aug 2005 13:51:54 -0000 1.37 --- stackDatabase.php 30 Aug 2005 14:29:25 -0000 1.38 *************** *** 516,528 **** * @return int $result the questionID of the question in the database, new or not. */ ! function stack_db_question_add($question,$newq=FALSE) ! { // Add a question to the DB. ! // If a question has an ID number, and $newq = FALSE, then we update the existing question. ! // Otherwise we store it as a new question. global $stackQuestion,$stack_web_url; // Take the first 30 chars from the question stem $pdes = substr($question['questionStem'],0,30); - - //If the description is empty, add the first 30 characters of the stem. if (array_key_exists('questionDescription',$question)) { if ('' == $question['questionDescription']) { --- 516,525 ---- * @return int $result the questionID of the question in the database, new or not. */ ! function stack_db_question_add($question,$newq=FALSE) { global $stackQuestion,$stack_web_url; + // Take the first 30 chars from the question stem + // If the description is empty, add the first 30 characters of the stem. $pdes = substr($question['questionStem'],0,30); if (array_key_exists('questionDescription',$question)) { if ('' == $question['questionDescription']) { *************** *** 589,593 **** $qu_fields = substr($qu_fields, 1); //Strip initial comma ! $qu_data = substr($qu_data, 1); // Build the query --- 586,590 ---- $qu_fields = substr($qu_fields, 1); //Strip initial comma ! $qu_data = substr($qu_data, 1); // Build the query *************** *** 669,673 **** global $stackQuestion,$stack_mysql; ! $query='SELECT * FROM stackQuestion WHERE questionID='.$questionID; $result= stack_db_query($query); --- 666,679 ---- global $stackQuestion,$stack_mysql; ! foreach ($stackQuestion as $qfield => $val) { ! if ('meta' == $val['type']) { ! $qfields[] = $qfield; ! $query .= ' ,'.$qfield; ! } ! } ! $query = substr($query,2,strlen($query)-2); ! ! $query='SELECT '.$query.' FROM stackQuestion WHERE questionID='.$questionID; ! $result= stack_db_query($query); *************** *** 679,690 **** $row = mysql_fetch_row($result); - $qfields = array(); - // Form a list of the data fields in a question - foreach( $stackQuestion as $qfield => $val) { - if ( 'meta' == $stackQuestion[$qfield]['type']) { - $qfields[]=$qfield; - } - } - foreach( $qfields as $qf => $val) { // Extract the infomation --- 685,688 ---- *************** *** 1686,1690 **** if (0 == $result) { ! return false; } --- 1684,1688 ---- if (0 == $result) { ! return false; } |
From: Chris S. <san...@us...> - 2005-08-30 14:29:35
|
Update of /cvsroot/stack/stack-1-0/scripts/install In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25899/scripts/install Modified Files: stackUpdateDatabase.php Log Message: Index: stackUpdateDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/install/stackUpdateDatabase.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** stackUpdateDatabase.php 29 Aug 2005 18:41:03 -0000 1.6 --- stackUpdateDatabase.php 30 Aug 2005 14:29:25 -0000 1.7 *************** *** 7,11 **** <?php ! require_once("{$stack_root}/stackConfig.php"); /** This PHP script simply adds new fields to STACK database for question and quiz metadata, --- 7,12 ---- <?php ! require_once("../../stackConfig.php"); ! require_once("../../stackLib.php"); /** This PHP script simply adds new fields to STACK database for question and quiz metadata, *************** *** 27,32 **** ADD COLUMN questionTimeAllocated time NULL, ADD COLUMN questionExcerciseType tinytext NULL, ! CHANGE questionDateLastEdited questionDateLastEdited TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, ! CHANGE questionUserLastEdited questionUserLastEdited TEXT NULL;'; $addQuizColumnQuery = ' --- 28,33 ---- ADD COLUMN questionTimeAllocated time NULL, ADD COLUMN questionExcerciseType tinytext NULL, ! CHANGE COLUMN questionDateLastEdited questionDateLastEdited TIMESTAMP NULL, ! CHANGE COLUMN questionUserLastEdited questionUserLastEdited TEXT NULL;'; $addQuizColumnQuery = ' *************** *** 35,39 **** ADD COLUMN quizKeywords tinytext NULL, ADD COLUMN quizUserLastEdited TEXT NULL, ! ADD COLUMN quizDateLastEdited TIMESTAMP ON UPDATE CURRENT_TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD COLUMN quizPublisher tinytext NULL, ADD COLUMN type tinytext NULL, --- 36,40 ---- ADD COLUMN quizKeywords tinytext NULL, ADD COLUMN quizUserLastEdited TEXT NULL, ! ADD COLUMN quizDateLastEdited TIMESTAMP NULL, ADD COLUMN quizPublisher tinytext NULL, ADD COLUMN type tinytext NULL, |
From: pkiddie <pk...@us...> - 2005-08-30 13:52:03
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15865/scripts Modified Files: stackAuthor.php stackDatabase.php stackQuiz.php stackXML.php Log Message: Instancing of new quiz moved to stackQuiz Order fields added to quiz_question db table Index: stackQuiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuiz.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** stackQuiz.php 26 Aug 2005 15:33:43 -0000 1.9 --- stackQuiz.php 30 Aug 2005 13:51:55 -0000 1.10 *************** *** 449,452 **** --- 449,479 ---- } + /** + * Creates a new quiz with the mimimum fields. + * + * @param int $quizid ID the quiz is to be initialised with + * @return array $quiz Question with the mimimum fields + */ + function stack_quiz_new($quizid) { + + global $stack_web_url, $user; + + $quiz['quizid'] = $quizid; + + //Automatically generated quiz metadata added + $quiz['quizGUID'] = stack_generate_guid($stack_web_url); + $quiz['quizFormat'] = 'text/xml; charset="utf-8"'; + $quiz['quizPublisher'] = $stack_web_url; + $quiz['type'] = 'quiz'; + $quiz['quizUserLastEdited'] = $user['firstname']." ".$user['lastname']; + + if ($user['email']!='') + { + $quiz['questionUserLastEdited'].=' <'.$user['email'].'>'; + } + + return $quiz; + } + Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** stackXML.php 30 Aug 2005 12:20:29 -0000 1.19 --- stackXML.php 30 Aug 2005 13:51:55 -0000 1.20 *************** *** 103,107 **** $xmlDoc = &new DOMIT_Document(); //Required for some method calls $questionFrag = &new DOMIT_Element('assessmentItem'); ! show_array($question); //Construct main body of XML file //Iterate through each $stackQuestion field, and check for the presence in the instantiated $question --- 103,107 ---- $xmlDoc = &new DOMIT_Document(); //Required for some method calls $questionFrag = &new DOMIT_Element('assessmentItem'); ! //show_array($question); //Construct main body of XML file //Iterate through each $stackQuestion field, and check for the presence in the instantiated $question Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** stackDatabase.php 25 Aug 2005 16:15:07 -0000 1.36 --- stackDatabase.php 30 Aug 2005 13:51:54 -0000 1.37 *************** *** 1528,1539 **** /** * Add a questionID to a quiz * * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! * @return void */ ! function stack_db_quiz_add_question($quizid,$questionID) { ! $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; $result = stack_db_query($query); } --- 1528,1546 ---- /** * Add a questionID to a quiz + * Used in stackAuthor.php * * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! + * @param int $qord The order of the question in the quiz, optional * @return void */ ! function stack_db_quiz_add_question($quizid,$questionID,$qord='NULL') { ! if ($qord==='NULL') ! $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; ! ! else ! $query = "INSERT INTO quiz_question (quizid, questionID, qord) VALUES ('$quizid','$questionID','$qord')"; ! $result = stack_db_query($query); } Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** stackAuthor.php 30 Aug 2005 10:28:01 -0000 1.33 --- stackAuthor.php 30 Aug 2005 13:51:54 -0000 1.34 *************** *** 709,714 **** */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! ! //show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; --- 709,714 ---- */ function stack_quiz_edit_form($quiz,&$errors,$PostTo = '') { ! ! show_array($quiz); global $_PHP_SELF,$stackQuiz,$stackOptions, $stack_stand_alone; *************** *** 736,741 **** echo "<input type='hidden' name='quiz[quizDateLastEdited]' value='$t' />\n ! <input type='hidden' name='quiz[quizGUID]' value='".sf($quiz,'quizGUID')."' />\n ! <input type='hidden' name='quiz[quizUserLastEdited]' value='".sf($quiz,'quizUserLastEdited')."' />\n <input type='hidden' name='quiz[quizPublisher]' value='".sf($quiz,'quizPublisher')."' />\n --- 736,740 ---- echo "<input type='hidden' name='quiz[quizDateLastEdited]' value='$t' />\n ! <input type='hidden' name='quiz[quizGUID]' value='".sf($quiz,'quizGUID')."' />\n <input type='hidden' name='quiz[quizUserLastEdited]' value='".sf($quiz,'quizUserLastEdited')."' />\n <input type='hidden' name='quiz[quizPublisher]' value='".sf($quiz,'quizPublisher')."' />\n |
From: pkiddie <pk...@us...> - 2005-08-30 13:52:02
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15865 Modified Files: editquiz.php import.php Log Message: Instancing of new quiz moved to stackQuiz Order fields added to quiz_question db table Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/import.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** import.php 30 Aug 2005 12:20:29 -0000 1.7 --- import.php 30 Aug 2005 13:51:54 -0000 1.8 *************** *** 258,261 **** --- 258,262 ---- stack_question_validate($quizQuestions[$key],$errs[$key]); stack_xml_reinstate_question_meta_defaults($qu); //Reinstate any missing question metadata + $qu['questionID'] = stack_db_question_add($qu); //Add question to db, and retrieve its new ID echo "<tr>\n <td>".sf($qu,'questionID')."</td> <td>".sf($qu,'questionName')." </td> <td>".sf($qu,'questionDescription')." </td> <td>".sf($qu,'questionKeywords')." </td>"; *************** *** 278,283 **** echo "<td><font color=\"greed\">Valid question</font></td>"; //For each valid question we must also add the question to the database ! stack_db_quiz_add_question($quiz['quizid'],$qu['questionID']); //For each question, add link from quiz to question } echo "</tr>\n"; --- 279,286 ---- echo "<td><font color=\"greed\">Valid question</font></td>"; + show_array($key); //For each valid question we must also add the question to the database ! stack_db_quiz_add_question($quiz['quizid'],$qu['questionID'],$key); //For each question, add link from quiz to question ! //explicitly state question order } echo "</tr>\n"; Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** editquiz.php 30 Aug 2005 12:20:28 -0000 1.19 --- editquiz.php 30 Aug 2005 13:51:54 -0000 1.20 *************** *** 152,168 **** if ('quiz_new' == $action) { ! $quiz['quizid'] = $quizid; ! ! //Automatically generated quiz metadata added ! $quiz['quizGUID'] = stack_generate_guid($stack_web_url); ! $quiz['quizFormat'] = 'text/xml; charset="utf-8"'; ! $quiz['quizPublisher'] = $stack_web_url; ! $quiz['type'] = 'quiz'; ! $quiz['quizUserLastEdited'] = $user['firstname']." ".$user['lastname']; ! ! if ($user['email']!='') ! { ! $question['questionUserLastEdited'].=' <'.$user['email'].'>'; ! } $action = 'quiz_edit'; --- 152,156 ---- if ('quiz_new' == $action) { ! $quiz = stack_quiz_new($quizid); $action = 'quiz_edit'; |
From: Chris S. <san...@us...> - 2005-08-30 12:20:51
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29496/scripts Modified Files: stackXML.php Log Message: Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** stackXML.php 30 Aug 2005 10:50:32 -0000 1.18 --- stackXML.php 30 Aug 2005 12:20:29 -0000 1.19 *************** *** 62,70 **** * 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) { //Validate the question --- 62,70 ---- * XML document to the calling function * ! * @see stack_xml_create_question_frag() * @param array $question A stackQuestion data structure * @return DOMIT_Document The XML document representing the question */ ! function stack_xml_create_question($question) { //Validate the question *************** *** 82,86 **** $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 --- 82,86 ---- $xmlDoc->appendChild($xmlDoc->createProcessingInstruction('xml', "version=\"1.0\" encoding=\"utf-8\"")); ! $questionFrag = &stack_xml_create_question_frag($question); //questionFrag head node is <assessmentItem>, add namespacing information to it *************** *** 97,101 **** * @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; --- 97,101 ---- * @return DOMIT_Element $questionFrag The root assessmentItem node with child question elements */ ! function &stack_xml_create_question_frag($question) { global $stackQuestion, $stack_ver, $xmlNamespaces; *************** *** 103,107 **** $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 --- 103,107 ---- $xmlDoc = &new DOMIT_Document(); //Required for some method calls $questionFrag = &new DOMIT_Element('assessmentItem'); ! show_array($question); //Construct main body of XML file //Iterate through each $stackQuestion field, and check for the presence in the instantiated $question *************** *** 110,115 **** //1. Write out metadata if ('meta' == $attribs['type'] && array_key_exists($qfield,$question)) { ! ! //Detect the metadata type switch ($attribs['metatype']) { --- 110,115 ---- //1. Write out metadata if ('meta' == $attribs['type'] && array_key_exists($qfield,$question)) { ! ! //Detect the metadata type switch ($attribs['metatype']) { *************** *** 269,273 **** * @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) { //Create question filename --- 269,273 ---- * @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($question,$directory) { //Create question filename *************** *** 278,282 **** } ! $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 --- 278,282 ---- } ! $xmlDoc = stack_xml_create_question($question); //Create the assessmentItem XML fragment $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); //Attempt to save XML file to requested directory *************** *** 293,301 **** * 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) { $xmlDoc = &new DOMIT_Document(); --- 293,301 ---- * Returns the containing XML document to the calling function * ! * @see stack_xml_create_quiz_frag() * @param array $quiz A stackQuiz data structure * @return DOMIT_Document The XML document representing the quiz */ ! function stack_xml_create_quiz($quiz) { $xmlDoc = &new DOMIT_Document(); *************** *** 309,313 **** //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?? --- 309,313 ---- //Create the quiz level metadata and options, wrapped in a <mathQuiz> container ! $quizFrag = stack_xml_create_quiz_frag($quiz); //<TODO> Does the quiz have any questions attached. If not, is there any point writing out?? *************** *** 322,329 **** stack_question_validate($question,$errors); //Validate it stack_xml_remove_question_meta_defaults($question); //Remove any disused fields before writing out - unset($question['questionID']); ! $questionFrag = &stack_xml_create_question_frag_new($question); //Write <assessmentItem> corresponding to this question //Include an order to each question on a question list --- 322,328 ---- stack_question_validate($question,$errors); //Validate it stack_xml_remove_question_meta_defaults($question); //Remove any disused fields before writing out unset($question['questionID']); ! $questionFrag = &stack_xml_create_question_frag($question); //Write <assessmentItem> corresponding to this question //Include an order to each question on a question list *************** *** 356,360 **** * @return DOMIT_Element $quizFrag The root mathQuiz node with child quiz elements */ ! function &stack_xml_create_quiz_frag_new($quiz) { global $stackQuiz, $xmlNamespaces; --- 355,359 ---- * @return DOMIT_Element $quizFrag The root mathQuiz node with child quiz elements */ ! function &stack_xml_create_quiz_frag($quiz) { global $stackQuiz, $xmlNamespaces; *************** *** 450,454 **** * @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) { //<TODO> How about using Quiz name? --- 449,453 ---- * @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($quiz,$directory) { //<TODO> How about using Quiz name? *************** *** 465,469 **** ! $xmlDoc = stack_xml_create_quiz_new($quiz); $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); --- 464,468 ---- ! $xmlDoc = stack_xml_create_quiz($quiz); $success = $xmlDoc->saveXML($directory."/".$xml_file_name,true); *************** *** 534,538 **** unset($question['questionID']); ! $questionFrag = &stack_xml_create_question_frag_new($question); //Include an order to each question on a question list --- 533,537 ---- unset($question['questionID']); ! $questionFrag = &stack_xml_create_question_frag($question); //Include an order to each question on a question list *************** *** 582,586 **** * 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 --- 581,585 ---- * Also adds a version to the head question element, based upon the current release of STACK. * ! * @see stack_xml_create_question() * @param DOMIT_Element &$headElement The element to which the namespacing information will be appended to, by reference * @return void *************** *** 619,624 **** * 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 --- 618,623 ---- * Also adds a version to the head quiz element, based upon the current release of STACK. * ! * @see stack_xml_create_quiz() ! * @see stack_xml_create_question_list() * @param DOMIT_Element &$headElement The element to which the namespacing information will be appended to, by reference * @return void *************** *** 656,660 **** * @return string The XML string representing the question */ ! function stack_xml_create_question_frag($question, $depth) { // Takes a $stackQuestion array, and returns and XML string fragment $xml = ''; --- 655,659 ---- * @return string The XML string representing the question */ ! function stack_xml_create_question_frag_old($question, $depth) { // Takes a $stackQuestion array, and returns and XML string fragment $xml = ''; *************** *** 695,699 **** * @return string The XML file name */ ! function stack_xml_write_question_file($question, $directory) { // takes a $stackQuestion array and writes it to an XML file in $directory --- 694,698 ---- * @return string The XML file name */ ! function stack_xml_write_question_file_old($question, $directory) { // takes a $stackQuestion array and writes it to an XML file in $directory *************** *** 958,962 **** if ($node->childNodes[0]->nodeType==3) { ! $array[$nodeName]=$node->getText(); } --- 957,967 ---- if ($node->childNodes[0]->nodeType==3) { ! $val = $node->getText(); ! ! //Only import node if it does actually have any text behind it, in metadata this will assume defaults ! if (!empty($val)) { ! $array[$nodeName]=$val; ! } ! } *************** *** 1056,1060 **** else { ! $array[$nodeName]=$node->getText(); } } --- 1061,1070 ---- else { ! $val = $node->getText(); ! ! //Do not write question field if there is no text behind it ! if (!empty($val)) { ! $array[$nodeName]=$val; ! } } } |
From: Chris S. <san...@us...> - 2005-08-30 12:20:51
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29496 Modified Files: editquiz.php import.php question_bank.php Log Message: Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/import.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** import.php 29 Aug 2005 19:08:04 -0000 1.6 --- import.php 30 Aug 2005 12:20:29 -0000 1.7 *************** *** 148,152 **** global $stackQuiz; - //1. Decide what has been imported if (array_key_exists('mathQuiz',$imported)) //If it is a quiz/list of questions --- 148,151 ---- *************** *** 356,360 **** echo '<th>ID</th><th>Name</th> <th>Description</th> <th>Key words</th> <th></th>'; echo '</tr></thead><tbody>'; - stack_question_validate($question,$errs); stack_xml_reinstate_question_meta_defaults($question); //Reinstate any missing metadata in order to all fields to database --- 355,358 ---- Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** editquiz.php 29 Aug 2005 19:08:04 -0000 1.18 --- editquiz.php 30 Aug 2005 12:20:28 -0000 1.19 *************** *** 175,179 **** $quiz = stack_db_quiz_get($quizid); stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata ! $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/{$stack_tmpdir}/"); } --- 175,179 ---- $quiz = stack_db_quiz_get($quizid); stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata ! $name = stack_xml_write_quiz($quiz,"{$stack_root}/{$stack_tmpdir}/"); } Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** question_bank.php 29 Aug 2005 19:08:04 -0000 1.13 --- question_bank.php 30 Aug 2005 12:20:29 -0000 1.14 *************** *** 139,143 **** include_once("{$stack_root}/scripts/stackXML.php"); stack_question_validate($question,$errors); ! $name = stack_xml_write_question_file($question, "{$stack_root}/{$stack_tmpdir}/"); $questions_to_export = TRUE; } --- 139,143 ---- include_once("{$stack_root}/scripts/stackXML.php"); stack_question_validate($question,$errors); ! $name = stack_xml_write_question($question, "{$stack_root}/{$stack_tmpdir}/"); $questions_to_export = TRUE; } |
From: pkiddie <pk...@us...> - 2005-08-30 10:50:41
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6399/scripts Modified Files: stackXML.php Log Message: Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** stackXML.php 30 Aug 2005 10:28:01 -0000 1.17 --- stackXML.php 30 Aug 2005 10:50:32 -0000 1.18 *************** *** 168,172 **** { $potRespFieldElem = &$xmlDoc->createElementNS('',$potRespKey); //Create a potential response field element - //print_r($potRespField); if (is_array($potRespField)) //Test for true/false branches { --- 168,171 ---- *************** *** 1371,1375 **** $dom->appendChild($questionFrag); $success = $dom->saveXML($directory."/".questionSchemaName,true); - return $success; } --- 1370,1373 ---- *************** *** 1652,1656 **** foreach($stackOptions as $arrayKey=>$optionField) { - show_array($optionField); if (!empty($optionField['type'])) { --- 1650,1653 ---- |
From: pkiddie <pk...@us...> - 2005-08-30 10:28:13
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2590/scripts/rqp Modified Files: RQPv1p0Server.php nb_soapfuncs.php Log Message: Resolving conflicts between rqp branch and head branch Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RQPv1p0Server.php 25 Aug 2005 16:06:18 -0000 1.2 --- RQPv1p0Server.php 30 Aug 2005 10:28:01 -0000 1.3 *************** *** 2,8 **** 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 ********* --- 2,7 ---- include("nb_easyxml_lite.php"); include("nb_soapfuncs.php"); ! include("../../stackstd.php"); ! //include("rqp_util.php"); //Stack/RQP utility function. /********* Data structures used by this web service ********* *************** *** 16,23 **** * ['teacherDocs']=>anyURI * ['adminDocs']=>anyURI ! * ['serverProperties']=>array({ ! * ['key']=>string ! * ['val']=>string ! * }, ...) * ['mimetypes']=>array(string, ...) * ['resources']=>array(anyURI, ...) --- 15,19 ---- * ['teacherDocs']=>anyURI * ['adminDocs']=>anyURI ! * ['serverProperties']=>array(key=>val, ...) * ['mimetypes']=>array(string, ...) * ['resources']=>array(anyURI, ...) *************** *** 26,33 **** * type ItemInformationDType{ * ['name']=>string ! * ['itemProperties']=>array({ ! * ['key']=>string ! * ['val']=>string ! * }, ...) * ['error']=>string * ['warning']=>string --- 22,26 ---- * type ItemInformationDType{ * ['name']=>string ! * ['itemProperties']=>array(key=>val, ...) * ['error']=>string * ['warning']=>string *************** *** 36,57 **** * type RenderDType{ * ['persistentData']=>string ! * ['outcomeVars']=>array({ ! * ['key']=>string ! * ['val']=>string ! * }, ...) * ['onSubmit']=>string * ['head']=>array(string, ...) ! * ['output']=>array({ ! * ['key']=>string ! * ['val']=>string ! * }, ...) * ['mimetype']=>string * ['files']=>array(anyURI, ...) * } * - * type kvPair{ - * ['key']=>string - * ['val']=>string - * } * * type input{ --- 29,40 ---- * type RenderDType{ * ['persistentData']=>string ! * ['outcomeVars']=>array(key=>val, ...) * ['onSubmit']=>string * ['head']=>array(string, ...) ! * ['output']=>array(key=>val, ...) * ['mimetype']=>string * ['files']=>array(anyURI, ...) * } * * * type input{ *************** *** 66,69 **** --- 49,202 ---- */ + //Temporary placeholder for global variables used in RQP + /* You need to tell STACK where it is, to create accurate URL's */ + $stack_host = 'localhost'; + $stack_basepath = 'stack-1-0'; + /* The URL of the site, with trailing slash */ + /* (You should not need to edit below) */ + $stack_web_url = 'http://'.$stack_host.'/'.$stack_basepath.'/'; + + $stack_ver['release'] = '1.0'; + $stack_ver['cvsmodule'] = 'stack-1-0'; + + $stack_web_services_provide = TRUE; + + // "Insert *s where needed"; + $stackOptions['InsertStars']['type'] = 'list'; + $stackOptions['InsertStars']['values'] = array('TRUE','FALSE'); + $stackOptions['InsertStars']['default'] = 'FALSE'; + + // 'Allow informal syntax'; + $stackOptions['InformalSyntax']['type'] = 'list'; + $stackOptions['InformalSyntax']['values'] = array('TRUE','FALSE'); + $stackOptions['InformalSyntax']['default'] = 'TRUE'; + + // 'Input tools'; + $stackOptions['AllowInputTool']['type'] = 'list'; + $stackOptions['AllowInputTool']['values'] = array('Form box','Form box + JOME'); + $stackOptions['AllowInputTool']['default'] = 'Form box + JOME'; + + // 'Syntax Hint'; + $stackOptions['SyntaxHint']['type'] = 'string'; + $stackOptions['SyntaxHint']['values'] = ''; + $stackOptions['SyntaxHint']['default'] = ''; + + // 'Display'; + $stackOptions['Display']['type'] = 'list'; + $stackOptions['Display']['values'] = array('String','LaTeX','MathML','LaTeX Source'); + $stackOptions['Display']['default'] = 'LaTeX'; + + // 'Language'; + $stackOptions['Language']['type'] = 'list'; + $stackOptions['Language']['values'] = array('en','es','nl'); + $stackOptions['Language']['default'] = 'en'; + + // 'Question value'; + $stackOptions['QuVal']['type'] = 'number'; + $stackOptions['QuVal']['values'] = ''; + $stackOptions['QuVal']['default'] = '1'; + + // 'Mark modification method'; + $stackOptions['MarkModMethod']['type'] = 'list'; + $stackOptions['MarkModMethod']['values'] = array('Penalty','Last Answer'); + $stackOptions['MarkModMethod']['default'] = 'Penalty'; + + // 'Question penalty'; + $stackOptions['Penalty']['type'] = 'number'; + $stackOptions['Penalty']['values'] = ''; + $stackOptions['Penalty']['default'] = '0.1'; + + // 'Forbidden words'; + $stackOptions['Forbid']['type'] = 'string'; + $stackOptions['Forbid']['values'] = ''; + $stackOptions['Forbid']['default'] = ''; + + // 'Allowed words'; + $stackOptions['Allow']['type'] = 'string'; + $stackOptions['Allow']['values'] = ''; + $stackOptions['Allow']['default'] = ''; + + // 'Answer test'; + $stackOptions['AnsTest']['type'] = 'list'; + $stackOptions['AnsTest']['values'] = ''; // This is automatically defined below, after the answer tests. + $stackOptions['AnsTest']['default'] = 'AlgEquiv'; + + // 'Answer test options'; + $stackOptions['AnsTestOpt']['type'] = 'string'; + $stackOptions['AnsTestOpt']['values'] = ''; + $stackOptions['AnsTestOpt']['default'] = ''; + + // "Teacher's email"; + $stackOptions['TeacherEmail']['type'] = 'string'; + $stackOptions['TeacherEmail']['values'] = ''; + $stackOptions['TeacherEmail']['default'] = ''; + + // 'Feedback: correct'; + $stackOptions['FeedBackGenericCorrect']['type'] = 'html'; + $stackOptions['FeedBackGenericCorrect']['values'] = ''; + $stackOptions['FeedBackGenericCorrect']['default'] = get_string('stackOptions_FeedBackGenericCorrect_def','stack',''); + + // 'Feedback: incorrect'; + $stackOptions['FeedBackGenericIncorrect']['type'] = 'html'; + $stackOptions['FeedBackGenericIncorrect']['values'] = ''; + $stackOptions['FeedBackGenericIncorrect']['default'] = get_string('stackOptions_FeedBackGenericIncorrect_def','stack',''); + + // 'Feedback: partially correct'; + $stackOptions['FeedBackGenericPCorrect']['type'] = 'html'; + $stackOptions['FeedBackGenericPCorrect']['values'] = ''; + $stackOptions['FeedBackGenericPCorrect']['default'] = get_string('stackOptions_FeedBackGenericPCorrect_def','stack',''); + + + // 'Show solution'; + $stackOptions['QuizMode']['type'] = 'list'; + $stackOptions['QuizMode']['values'] = array('Practice','Assessment','Strict'); + $stackOptions['QuizMode']['default'] = 'Practice'; + + $stackAnswerTest['AlgEquiv']['imp'] = 'cas'; + $stackAnswerTest['AlgEquiv']['function'] = 'ATAlgEquiv'; + + $stackAnswerTest['CASEqual']['imp'] = 'cas'; + $stackAnswerTest['CASEqual']['function'] = 'ATCASEqual'; + + $stackAnswerTest['FacForm']['imp'] = 'cas-var'; + $stackAnswerTest['FacForm']['function'] = 'ATFacForm'; + + $stackAnswerTest['SA_factored']['imp'] = 'cas-var'; + $stackAnswerTest['SA_factored']['function'] = 'ATFacForm'; + + $stackAnswerTest['SA_expanded']['imp'] = 'cas-var'; + $stackAnswerTest['SA_expanded']['function'] = 'ATExpanded'; + + $stackAnswerTest['PartFrac']['imp'] = 'cas-var'; + $stackAnswerTest['PartFrac']['function'] = 'AtPartFrac'; + + $stackAnswerTest['Diff']['imp'] = 'cas-var'; + $stackAnswerTest['Diff']['function'] = 'ATDiff'; + + $stackAnswerTest['Int']['imp'] = 'cas-var'; + $stackAnswerTest['Int']['function'] = 'ATInt'; + + $stackAnswerTest['SA_True']['imp'] = 'cas-loc'; + $stackAnswerTest['SA_True']['function'] = 'cas'; + + $stackAnswerTest['Num_tol_relative']['imp'] = 'cas-loc'; + $stackAnswerTest['Num_tol_relative']['function'] = 'cas'; + + $stackAnswerTest['Num_tol_relative']['imp'] = 'cas-loc'; + $stackAnswerTest['Num_tol_absolute']['function'] = 'cas'; + + $stackAnswerTest['String']['imp'] = 'php'; + $stackAnswerTest['StringSloppy']['imp'] = 'php'; + $stackAnswerTest['RegExp']['imp'] = 'php'; + $stackAnswerTest['True']['imp'] = 'php'; + + // Build a list of AnswerTests. + // and add these to the options. + $ats = ''; + foreach( $stackAnswerTest as $field => $q_field) + { $ats[] = $field; } + + $stackOptions['AnsTest']['values'] = $ats; + class RQPv1p0 extends RQPv1p0_nbSOAP { *************** *** 72,101 **** /** * web service provider method RQP_ServerInformation ! * ! * @return ServerInformationDType */ function RQP_ServerInformation() { ! // return new nbSOAPFault("unimplemented", "The RQP_ServerInformationservice has not been implemented yet", ""); ! global $stack_ver, $stack_web_url; ! $si['type'] = "STACK"; ! $si['version'] = $stack_ver['release']; ! $si['rqpVersion'] = "1.0"; $si['details'] = "{$stack_web_url}scripts/rqp/stackDetails.php"; //url of the server $si['studentDocs'] = "{$stack_web_url}scripts/rqp/stackDocs.php?action=student"; //stack/lang/en/doc - studentinput $si['teacherDocs'] = "{$stack_web_url}scripts/rqp/stackDocs.php?action=teacher"; //about $si['adminDocs'] = "{$stack_web_url}scripts/rqp/stackDocs.php?action=admin"; //author ! $si['serverProperties'] = array(array ('key' => 'rendering', 'val' => TRUE), ! array ('key' => 'implicitCloning', 'val' => FALSE), ! array ('key' => 'explicitCloning', 'val' => FALSE), ! array ('key' => 'authoring', 'val' => TRUE), ! array ('key' => 'adminOptions', 'val' => TRUE), ! array ('key' => 'teacherOptions', 'val'=> FALSE), ! array ('key' => 'userOptions', 'val' => TRUE) ); ! ! $si['mimetypes'] = array("text/html"); ! $si['resources'] = array("Location of JOME and any other prerequisites for server operation"); ! return $si; } --- 205,238 ---- /** * web service provider method RQP_ServerInformation ! * ! * @return ServerInformationDType */ function RQP_ServerInformation() { ! include("../../stackstd.php"); //Reqd for version info for STACK ! global $stack_ver, $stack_web_url, $stack_web_services_provide; ! if (!$stack_web_services_provide) { ! return new nbSOAPFault("notImplemented", "The RQP_ServerInformation service is not available on this server"); ! } ! ! // return new nbSOAPFault("unimplemented", "The RQP_ServerInformationservice has not been implemented yet", ""); ! $si['type'] = "STACK"; ! $si['version'] = $stack_ver['release']; ! $si['rqpVersion'] = "1.0"; $si['details'] = "{$stack_web_url}scripts/rqp/stackDetails.php"; //url of the server $si['studentDocs'] = "{$stack_web_url}scripts/rqp/stackDocs.php?action=student"; //stack/lang/en/doc - studentinput $si['teacherDocs'] = "{$stack_web_url}scripts/rqp/stackDocs.php?action=teacher"; //about $si['adminDocs'] = "{$stack_web_url}scripts/rqp/stackDocs.php?action=admin"; //author ! $si['serverProperties']=array('rendering' => TRUE, ! 'implicitCloning' => FALSE, ! 'explicitCloning' => FALSE, ! 'authoring' => TRUE, ! 'adminOptions' => TRUE, ! 'teacherOptions'=> FALSE, ! 'userOptions' => TRUE); ! $si['mimetypes']=array("text/html"); ! $si['resources']=array("Location of JOME and any other prerequisites for server operation"); ! return $si; } *************** *** 103,117 **** /** * web service provider method RQP_ItemInformation ! * * @param source : string ! * @return ItemInformationDType */ function RQP_ItemInformation($source) { ! //return new nbSOAPFault("unimplemented", "The RQP_ItemInformationservice has not been implemented yet", ""); ! // Fill in web method fuctionality here. ! // return a ItemInformationDType ! ! //First we check to see if the source intantiates a valid question, if so set isValid to true $item = sourceHandler($source); --- 240,255 ---- /** * web service provider method RQP_ItemInformation ! * * @param source : string ! * @return ItemInformationDType */ function RQP_ItemInformation($source) { ! global $stack_web_services_provide; ! ! if (!$stack_web_services_provide) { ! return new nbSOAPFault("notImplemented", "The RQP_ItemInformation service is not available on this server"); ! } ! //First we check to see if the source intantiates a valid question, if so set isValid to true $item = sourceHandler($source); *************** *** 168,176 **** //$itemInfo['warning'] =>; // Retrieved from source parser } /** * web service provider method RQP_Render ! * * @param source : string * @param options : kvPair[] --- 306,317 ---- //$itemInfo['warning'] =>; // Retrieved from source parser + return new nbSOAPFault("unimplemented", "The RQP_ItemInformationservice has not been implemented yet", ""); + // Fill in web method fuctionality here. + // return a ItemInformationDType } /** * web service provider method RQP_Render ! * * @param source : string * @param options : kvPair[] *************** *** 183,232 **** * @param resourceBase : anyURI * @param tempfileBase : anyURI ! * @return RenderDType */ ! function RQP_Render($source, $options, $persistentData, $inputData, $directives, $mimetypes, $namePrefix, $itemBase, $resourceBase, $tempfileBase) ! { ! if (empty($source) && $directives[4]['val']==TRUE) ! { ! require_once('../stackAuthor.php'); ! ! $question = ''; ! $errors = ''; ! $render['persistentData'] = ''; ! $render['outcomeVars'] = array( array('key' => 'completion', 'val' => 'unknown'), ! array('key' => 'score', 'val' => '0'), ! array('key' => 'rawScore', 'val' => '0'), ! array('key' => 'penalty', 'val' => '0'), ! array('key' => 'valid', 'val' => TRUE), ! array('key' => 'source', 'val' => 'edited sourcce'), ! array('key' => 'options', 'val' => 'options string') ) ; ! $render['onSubmit'] = "</script> ! function EditQ(action) { ! f = document.stackeditqform; ! f.action.value = action; ! f.target = '_self'; ! f.submit(); ! }; ! <script type=".'"'.'text/javascript">'; ! $render['head'] = array(); ! $render['output'] = array( array('key' => 'title', 'val' => ''), //initially question will have no title ! array('key' => 'body', 'val' => stack_question_edit_form_rqp($question,&$errors)), ! array('key' => 'stem', 'val' => ''), ! array('key' => 'feedback', 'val' => ''), ! array('key' => 'response', 'val' => ''), ! array('key' => 'answer', 'val' => ''), ! array('key' => 'solution', 'val' => '') ); ! $render['mimetype'] = 'text/html'; ! $render['files'] = array(); ! //New question - return this form in render op ! //May need to set $questionId initially; ! ! return $render; } /*$outcomeVars = array(); --- 324,420 ---- * @param resourceBase : anyURI * @param tempfileBase : anyURI ! * @return RenderDType */ ! function RQP_Render($source, $options, &$persistentData, $inputData, $directives, $mimetypes, $namePrefix, $itemBase, $resourceBase, $tempfileBase) ! { ! global $stack_web_services_provide; ! ! if (!$stack_web_services_provide) { ! return new nbSOAPFault("notImplemented", "The RQP_ServerInformation service is not available on this server"); ! } ! ! require("../../stackstd.php"); //Reqd for version info for STACK ! //require("../moodlelib.php"); ! require_once('../stackAuthor.php'); ! //require_once('../stackQuestion.php'); ! //Response parameters ! $persistentData=''; ! $outcomeVars=''; ! $onSubmit=''; ! $head=''; ! $output=''; ! $mimetype=''; ! $files=''; ! ! //1. User wants to author a question ! if (in_array('edit',$directives)) //if this is set, disregard other directives ! { ! $errors=''; //Used in authoring form ! //1.1 Is a new question to be authored, or an existing one ! if (empty($source)) ! { ! $question = stack_question_new('Paul Kiddie'); //Create question with mim fields. Todo, how do we get admin name from Moodle ! ! show_array($question); ! $persistentData = ''; ! $outcomeVars = array('completion' => 'unknown', ! 'score' => '0', ! 'rawScore' => '0', ! 'penalty' => '0', ! 'valid' => TRUE, ! 'source' => 'edited sourcce', ! 'options' => 'options string'); ! ! $onSubmit = "</script> ! function EditQ(action) { ! f = document.stackeditqform; ! f.action.value = action; ! f.target = '_self'; ! f.submit(); ! }; ! <script type=".'"'.'text/javascript">'; ! $head = '<script type="text/javascript"> ! window.focus(); ! function EditQ(action) { ! f = document.stackeditqform; ! f.action.value = action; ! f.target = "_self"; ! f.submit(); ! }; ! </script>'; ! $output = array('title' => '', //initially question will have no title ! //remoteCaller = true ! 'body' => stack_question_edit_form_substance($question,&$errors, $namePrefix, TRUE), ! 'stem' => '', ! 'feedback' => '', ! 'response' => '', ! 'answer' => '', ! 'solution' => ''); + $mimetype = 'text/html'; + $files = array(); + } ! else if (!empty($source)) ! { ! //Use existing source to fill in fields within authoring form ! //Import source XML and display question editing form ! ! } } + + //Construct RenderType + $render = array('persistentData' => $persistentData, + 'outcomeVars' => $outcomeVars, + 'onSubmit' => $onSubmit, + 'head' => $head, + 'output' => $output, + 'mimetype' => $mimetype, + 'files' => $files); + return $render; + /*$outcomeVars = array(); *************** *** 1088,1099 **** $output = soap_encode_array($output, 'output', 'output', RQP_URI_NAMESPACE);*/ ! ! ! ! //return array('templateVars' => $templateVars, 'persistentData' => $persistentData, 'outcomeVars'=> $outcomeVars, 'output' => $output); ! return new nbSOAPFault("unimplemented", "The RQP_Renderservice has not been implemented yet", ""); ! // Fill in web method fuctionality here. - // return a RenderDType } --- 1276,1282 ---- $output = soap_encode_array($output, 'output', 'output', RQP_URI_NAMESPACE);*/ ! ! //return new nbSOAPFault("unimplemented", "The RQP_Renderservice has not been implemented yet", ""); // Fill in web method fuctionality here. // return a RenderDType } *************** *** 1101,1108 **** /** * web service provider method RQP_Clone ! * * @param source : string * @param number : int ! * @return CloneDType */ function RQP_Clone($source, $number) --- 1284,1291 ---- /** * web service provider method RQP_Clone ! * * @param source : string * @param number : int ! * @return CloneDType */ function RQP_Clone($source, $number) *************** *** 1640,1644 **** while(list($k, $v)=each($input)) { ! $ret .= $this->soapify_kvPair($v, "kvPair") . "\n"; } } --- 1823,1829 ---- while(list($k, $v)=each($input)) { ! // manual changes to simplify PHP kvPair arrays start here ! $ret .= $this->soapify_kvPair(array("key"=>$k, "val"=>$v) , "kvPair") . "\n"; ! // manual changes to simplify PHP kvPair arrays end here } } *************** *** 1651,1659 **** function desoap_kvPairArray($xml, $idx, $name) { ! $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { ! $ret[] = $this->desoap_kvPair($xml, $cidx, "kvPair"); $cidx = $xml->FindNextPeer($cidx); } --- 1836,1847 ---- function desoap_kvPairArray($xml, $idx, $name) { ! $ret = array(); $cidx = $xml->FindChildElement($idx); while($cidx != false) { ! // manual changes to simplify PHP kvPair arrays start here ! $pair = $this->desoap_kvPair($xml, $cidx, "kvPair"); ! $ret[$pair['key']] = $pair['val']; ! // manual changes to simplify PHP kvPair arrays end here $cidx = $xml->FindNextPeer($cidx); } Index: nb_soapfuncs.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/nb_soapfuncs.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** nb_soapfuncs.php 25 Aug 2005 16:06:18 -0000 1.2 --- nb_soapfuncs.php 30 Aug 2005 10:28:01 -0000 1.3 *************** *** 65,71 **** $startTime = time(); $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) --- 65,77 ---- $startTime = time(); $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); + if($sock==FALSE) + { + $fault = new nbSOAPFault("Server", "Timed out trying to contact server.", "No response from server."); + $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; + return nbSOAP_Envelope($fault); + } stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) *************** *** 85,98 **** $cl = strlen($contents); $contents .= fread($sock, 8192); ! /* if(!$headersComplete) { ! $headerEnd = strpos($contents,"\r\n\r\n"); ! if($headerEnd != false) { ! $headersComplete = true; ! $clp = strpos($contents,"Content-Length:"); ! $cle = strpos($contents,"\r\n",$clp); ! $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); ! $headerLength = $cle+4; } } --- 91,123 ---- $cl = strlen($contents); $contents .= fread($sock, 8192); ! if(!$headersComplete) { ! //# remove any leading continues ! $headerEnd = strpos($contents,"\r\n\r\n"); ! while(($headerEnd != false)&&(!$headersComplete)) { ! $fle = strpos($contents,"\r\n"); // first line end ! $line = substr($contents, 0, $fle); ! list($protocol, $rcode) = split(" ", $line, 3); ! $rcode = intval($rcode); // ensure its an integer; ! if(($rcode >= 100)&&($rcode <= 199)) // informational, I'm not interested ! { ! $contents = substr($contents, $headerEnd+4); ! $headerEnd = strpos($contents,"\r\n\r\n"); ! } ! elseif($rcode == 200) ! { ! $headersComplete = true; ! $clp = strpos($contents,"Content-Length:"); ! $cle = strpos($contents,"\r\n",$clp); ! $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); ! $headerLength = $cle+4; ! } ! else ! { ! $fault = new nbSOAPFault("Server", "An http error was returned, http code $rcode", "An http error was returned, http code $rcode"); ! $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; ! return nbSOAP_Envelope($fault); ! } } } *************** *** 101,113 **** if(strlen($contents)>=$contentLength+$headerLength) $pageComplete = true; ! } */ $callTime = time()-$startTime; if($callTime >= $timeLimit) $pageComplete = true; ! echo "<p><i><pre>[" . htmlentities($contents) . "]</pre></i></p>"; } fclose($sock); } ! echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } --- 126,143 ---- if(strlen($contents)>=$contentLength+$headerLength) $pageComplete = true; ! } $callTime = time()-$startTime; if($callTime >= $timeLimit) + { $pageComplete = true; ! $fault = new nbSOAPFault("Server", "Timed out calling server.", "No response, or an incomplete response before the request timed out."); ! $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; ! return nbSOAP_Envelope($fault); ! } ! //echo "<p><i><pre>[" . htmlentities($contents) . "]</pre></i></p>"; } fclose($sock); } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } *************** *** 129,133 **** $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); ! echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) --- 159,163 ---- $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, 30); stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) *************** *** 144,148 **** fclose($sock); } ! echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; --- 174,178 ---- fclose($sock); } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; |
From: pkiddie <pk...@us...> - 2005-08-30 10:28:13
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2590/scripts Modified Files: stackAuthor.php stackQuestion.php stackXML.php Log Message: Resolving conflicts between rqp branch and head branch Index: stackAuthor.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackAuthor.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** stackAuthor.php 29 Aug 2005 16:52:33 -0000 1.32 --- stackAuthor.php 30 Aug 2005 10:28:01 -0000 1.33 *************** *** 16,31 **** /** * Display the name of a option field, in a link generating a popup window. * * @param string $field The field name * @return string The link to the popup window */ ! function stack_question_edit_dispoptionfield($field) { global $stackOptions; $fd='stackOptions_'.$field; $fd=get_string($fd,'stack',''); ! $strout = "<a href=\"javascript:HelpPopup('$field','stackOptions');\">$fd</a>"; ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackOptions');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); } --- 16,40 ---- /** * Display the name of a option field, in a link generating a popup window. + * Added $remoteCaller, which if not specified defaults to false. This prevents the display of the help * * @param string $field The field name * @return string The link to the popup window */ ! function stack_question_edit_dispoptionfield($field,$remoteCaller=FALSE) { global $stackOptions; $fd='stackOptions_'.$field; $fd=get_string($fd,'stack',''); ! ! if (!$remoteCaller) ! { ! $strout = "<a href=\"javascript:HelpPopup('$field','stackOptions');\">$fd</a>"; ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackOptions');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); ! } ! ! else if ($remoteCaller) { ! return($fd); ! } } *************** *** 71,75 **** * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname) { global $stackOptions; --- 80,84 ---- * @return void */ ! function stack_options_edit_form($options_headings,$options_list,$options,$fieldname,$remoteCaller=FALSE) { global $stackOptions; *************** *** 80,84 **** foreach( $options_list as $k => $opt) { ! $descript = stack_question_edit_dispoptionfield($opt); $name = $fieldname.'['.$opt.']'; $category = $options_headings[$k]; --- 89,93 ---- foreach( $options_list as $k => $opt) { ! $descript = stack_question_edit_dispoptionfield($opt,$remoteCaller); $name = $fieldname.'['.$opt.']'; $category = $options_headings[$k]; *************** *** 143,147 **** function stack_question_edit_form($question,&$errors,$PostTo = '') { global $_PHP_SELF; - //show_array($question); if (empty($PostTo)) { --- 152,155 ---- *************** *** 160,185 **** } - function stack_question_edit_form_rqp($question,&$errors,$PostTo = '') { - global $_PHP_SELF; - - $html = ''; - //show_array($question); - - if (empty($PostTo)) { - $PostTo=$_PHP_SELF; - } - - // Timestamp this edit - $html .= "<form name='stackeditqform' action='$PostTo' method='POST'>\n"; - - $html .=stack_question_edit_form_substance_rqp($question,$errors); - - $html .= "<input type='hidden' name='action' value='' />\n"; - $html .= "<submit name='dummy' value=''>"; - $html .= "</form>\n\n\n"; // form in which questions are edited. - - return $html; - } - /** * Build the substance of the form to edit a STACK question. --- 168,171 ---- *************** *** 188,199 **** * @param array $question The STACK question * @param array &$errors Repository for errors * @return void */ ! function stack_question_edit_form_substance_rqp($question,&$errors) { ! global $stack_stand_alone,$stackQuestion,$stackOptions,$debug,$user; $t=time(); $dts = strftime('%c',$t); // Format the string. - $html = ''; if (array_key_exists('questionOptions',$question)) { // option set in question --- 174,185 ---- * @param array $question The STACK question * @param array &$errors Repository for errors + * @param string $prefix The string which to prefix all input fields * @return void */ ! function stack_question_edit_form_substance($question,&$errors, $prefix='', $remoteCaller=FALSE) { ! global $stackQuestion,$stackOptions,$debug,$user; $t=time(); $dts = strftime('%c',$t); // Format the string. if (array_key_exists('questionOptions',$question)) { // option set in question *************** *** 203,416 **** } $optval = stack_options_formvals_set($question_options); - - // Add all the metadata to the question ! // hidden metadata ! $html .= "\n<hr />\n ! <input type='hidden' name='questionID' value='".sf($question,'questionID')."' />\n ! <input type='hidden' name='questionGUID' value='".sf($question,'questionGUID')."' />\n ! <input type='hidden' name='questionDateLastEdited' value='$t' />\n ! <input type='hidden' name='questionUserLastEdited' value='".sf($question,'questionUserLastEdited')."' />\n ! <input type='hidden' name='questionPublisher' value='".sf($question,'questionPublisher')."' />\n ! <input type='hidden' name='type' value='".sf($question,'type')."' />\n ! <input type='hidden' name='questionFormat' value='".sf($question,'questionFormat')."' />\n ! ! <table cellboarder='0' cellpadding='2'> ! <tr> <td>".get_string('stackQuestion_questionName','stack','').":</td> ! <td><input type='input' name='questionName' value='".sf($question,'questionName')."' size='25' /> (ID: ".sf($question,'questionID').") </td> </tr> ! <tr> <td>".get_string('stackQuestion_questionDescription','stack','').":</td> ! <td><input type='input' name='questionDescription' value='".sf($question,'questionDescription')."' size='60' /></tr> ! <tr> <td>".get_string('stackQuestion_questionKeywords','stack','').":</td> ! <td><input type='input' name='questionKeywords' value='".sf($question,'questionKeywords')."' size='60' /></tr> ! ! </table> "; ! ! // HACK: the field type in the database does not ! // allow these to be edited yet. ! // <tr> <td> Last edited by: </td> ! // <td> <input type='input' name='questionUserLastEdited' value='".stack_s($question['questionUserLastEdited'])."' size='40' /> on $dts.</td> ! // </tr> ! ! $html .= "\n<hr />\n"; ! ! // Buttons to go somewhere next ! if ($stack_stand_alone) { ! $html .= "<a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; ! if (''==$errors) { ! $html .= "<a href=\"javascript:EditQ('preview')\">Try question</a> \n"; ! $html .= "<a href=\"javascript:EditQ('export_xml')\">Export as XML</a> \n"; ! if ('admin'==$user['username']) { ! $html .= "<a href=\"javascript:EditQ('save')\">Store question</a>\n ! <a href=\"javascript:EditQ('save_as')\">Store as a new question </a>\n"; ! } ! } ! $html .= "</p>"; ! } ! ! // Add the meat of the question. ! $qfield='questionVarsRaw'; ! $html .= "<b>".stack_question_edit_dispquestionfield($qfield)."</b><br />"; ! ! // Replace all \n's with ;'s ! if (array_key_exists($qfield,$question)) { ! $strout = str_replace(";","\n",$question[$qfield]); ! } else { $strout = ''; } ! stack_question_edit_form_field($qfield,$strout,$errors); ! $html .= "\n\n<br />\n"; ! ! $qfield='questionStem'; ! $html .= "<b>".stack_question_edit_dispquestionfield($qfield)."</b><br />"; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! ! $html .= "<p><table align=top><tr align=top>\n"; ! if (array_key_exists('questionPotResp',$question)) { ! $html .= " <td><b>".stack_question_edit_dispquestionfield('questionAns')."</b></td>\n"; ! $html .= "<td> </td></tr>\n\n<tr align=top>\n <td align=top>"; ! $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "</td>\n <td> </td></tr>"; ! } else { ! // The questionAns and associated fields ! ! $html .= " <td><b>".stack_question_edit_dispquestionfield('questionAns')."</b></td>\n"; ! $html .= " <td><b>".stack_question_edit_dispoptionfield('AnsTest')."</b></td>\n"; ! $html .= " <td><b>".stack_question_edit_dispoptionfield('AnsTestOpt')."</b></td>\n"; ! $html .= "</tr>\n\n<tr align=top>\n <td align=top>"; ! ! $qfield='questionAns'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "</td>\n <td align=top>\n"; ! ! $opt = 'AnsTest'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); ! $html .= "</td>\n <td align=top>\n"; ! ! $opt = 'AnsTestOpt'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt],20); ! $html .= "</td>\n</tr>"; ! ! $html .= "<tr align=top><td></td> ! <td>({$stackOptions['AnsTest']['default']})</td> ! <td>{$stackOptions['AnsTestOpt']['default']}</td></tr>"; ! } ! ! $html .= "<tr align=top>\n"; ! $html .= " <td> <b>".stack_question_edit_dispoptionfield('QuVal')."</b></td>\n"; ! $html .= " <td> <b>".stack_question_edit_dispoptionfield('Penalty')."</b></td>\n"; ! $html .= "<td></td><td></td></tr>\n<tr>\n <td>"; ! ! $opt = 'QuVal'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); ! $html .= " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; ! ! $opt = 'Penalty'; ! $opt_name = "questionOptions[{$opt}]"; ! @stack_question_edit_option_form($opt_name,$opt,$optval[$opt]); ! $html .= " ({$stackOptions[$opt]['default']})</td>\n <td>\n"; ! ! $html .= "</table></p>\n\n"; ! ! // Potential responses ! $html .= "<br /><a href=\"javascript:EditQ('edit')\">Edit</a> and add \n"; ! $html .= '<input type="input" name="questionPotResp[add]" value="0" size="3" />'; ! $html .= " potential responses<a href=\"javascript:HelpPopup('all','author_potresp');\"><img align=\"middle\" border=\"0\" height=\"17\" width=\"17\" src=\"pics/help.gif\" /></a> (distractors etc).<br />"; ! ! if (array_key_exists('questionPotResp',$question)) { ! if (array_key_exists('0',$question['questionPotResp'])) { ! // Add the AnsKey field ! $qfield='questionAnsKey'; ! $html .= '<p><b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= '</p>'; ! ! // Add the AnsVars field, isnce this may now be used. ! $qfield='questionAnsVarsRaw'; ! $html .= '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! $strout = ''; ! if (array_key_exists($qfield,$question)) { ! $strout = str_replace(";","\n",$question[$qfield]); ! } ! @stack_question_edit_form_field($qfield,$strout,$errors); ! $html .= "\n\n<br />\n"; ! ! $html .= '<p>'; ! $npr = count($question['questionPotResp']); ! foreach ($question['questionPotResp'] as $key => $potresp) { ! $potresp['order']=$key; ! @stack_question_edit_potresp($key,$potresp,$npr,$errors); ! } ! $html .= '</p>'; ! ! } // end questionPotResp ! } else { // This needs its default, non-empty value. ! $html .= "<input type='hidden' name='questionAnsKey' value='".stack_s($question['questionAnsKey'])."' />\n"; ! } ! ! $qfield='questionSol'; ! $html .= '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "\n\n<br />\n"; ! ! $qfield='questionNote'; ! $html .= '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; ! @stack_question_edit_form_field($qfield,$question[$qfield],$errors); ! $html .= "\n\n<br />\n"; ! ! // Buttons to go somewhere next ! if ($stack_stand_alone) { ! $html .= "<p><a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; ! if (''==$errors) { ! $html .= "<a href=\"javascript:EditQ('preview')\">Try question</a> \n"; ! $html .= "<a href=\"javascript:EditQ('export_xml')\">Export as XML</a> \n"; ! if ('admin'==$user['username']) { ! $html .= "<a href=\"javascript:EditQ('save')\">Store question</a>\n ! <a href=\"javascript:EditQ('save_as')\">Store as a new question</a>\n"; ! } ! } ! $html .= "</p>"; ! } ! ! $options_headings = array(get_string('stackOptions_edit_inmeth','stack'),'','','',get_string('stackOptions_edit_resppro','stack'),'','','','','',get_string('stackOptions_edit_out','stack')); ! $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); ! ! stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions'); ! ! $html .= "\n<hr />\n"; ! ! //List of metadata to display ! $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', ! 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); ! stack_question_metadata_edit_form($question,$metadata_list); //Create all metadata fields on question form ! ! $html .= "\n<hr />\n"; ! ! return $html; ! } // end of edit_form_table ! ! /** ! * Build the substance of the form to edit a STACK question. ! * This needs to be wrapped in a <form> </form> structure. ! * ! * @param array $question The STACK question ! * @param array &$errors Repository for errors ! * @return void ! */ ! function stack_question_edit_form_substance($question,&$errors) { ! global $stack_stand_alone,$stackQuestion,$stackOptions,$debug,$user; ! ! $t=time(); ! $dts = strftime('%c',$t); // Format the string. ! ! if (array_key_exists('questionOptions',$question)) { // option set in question ! $question_options = $question['questionOptions']; ! } else { ! $question_options = array(); ! } ! $optval = stack_options_formvals_set($question_options); ! ! // Add all the metadata to the question // hidden metadata --- 189,195 ---- } $optval = stack_options_formvals_set($question_options); ! //For use by RQP - buffer these echo's ! ob_start(); // hidden metadata *************** *** 443,447 **** // Buttons to go somewhere next ! if ($stack_stand_alone) { echo "<a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; if (''==$errors) { --- 222,226 ---- // Buttons to go somewhere next ! if (!$remoteCaller) { echo "<a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; if (''==$errors) { *************** *** 458,462 **** // Add the meat of the question. $qfield='questionVarsRaw'; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b><br />"; // Replace all \n's with ;'s --- 237,241 ---- // Add the meat of the question. $qfield='questionVarsRaw'; ! echo "<b>".stack_question_edit_dispquestionfield($qfield,$remoteCaller)."</b><br />"; // Replace all \n's with ;'s *************** *** 468,477 **** $qfield='questionStem'; ! echo "<b>".stack_question_edit_dispquestionfield($qfield)."</b><br />"; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "<p><table align=top><tr align=top>\n"; if (array_key_exists('questionPotResp',$question)) { ! echo " <td><b>".stack_question_edit_dispquestionfield('questionAns')."</b></td>\n"; echo "<td> </td></tr>\n\n<tr align=top>\n <td align=top>"; $qfield='questionAns'; --- 247,256 ---- $qfield='questionStem'; ! echo "<b>".stack_question_edit_dispquestionfield($qfield,$remoteCaller)."</b><br />"; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "<p><table align=top><tr align=top>\n"; if (array_key_exists('questionPotResp',$question)) { ! echo " <td><b>".stack_question_edit_dispquestionfield('questionAns',$remoteCaller)."</b></td>\n"; echo "<td> </td></tr>\n\n<tr align=top>\n <td align=top>"; $qfield='questionAns'; *************** *** 481,487 **** // The questionAns and associated fields ! echo " <td><b>".stack_question_edit_dispquestionfield('questionAns')."</b></td>\n"; ! echo " <td><b>".stack_question_edit_dispoptionfield('AnsTest')."</b></td>\n"; ! echo " <td><b>".stack_question_edit_dispoptionfield('AnsTestOpt')."</b></td>\n"; echo "</tr>\n\n<tr align=top>\n <td align=top>"; --- 260,266 ---- // The questionAns and associated fields ! echo " <td><b>".stack_question_edit_dispquestionfield('questionAns',$remoteCaller)."</b></td>\n"; ! echo " <td><b>".stack_question_edit_dispoptionfield('AnsTest',$remoteCaller)."</b></td>\n"; ! echo " <td><b>".stack_question_edit_dispoptionfield('AnsTestOpt',$remoteCaller)."</b></td>\n"; echo "</tr>\n\n<tr align=top>\n <td align=top>"; *************** *** 506,511 **** echo "<tr align=top>\n"; ! echo " <td> <b>".stack_question_edit_dispoptionfield('QuVal')."</b></td>\n"; ! echo " <td> <b>".stack_question_edit_dispoptionfield('Penalty')."</b></td>\n"; echo "<td></td><td></td></tr>\n<tr>\n <td>"; --- 285,290 ---- echo "<tr align=top>\n"; ! echo " <td> <b>".stack_question_edit_dispoptionfield('QuVal',$remoteCaller)."</b></td>\n"; ! echo " <td> <b>".stack_question_edit_dispoptionfield('Penalty',$remoteCaller)."</b></td>\n"; echo "<td></td><td></td></tr>\n<tr>\n <td>"; *************** *** 531,535 **** // Add the AnsKey field $qfield='questionAnsKey'; ! echo '<p><b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo '</p>'; --- 310,314 ---- // Add the AnsKey field $qfield='questionAnsKey'; ! echo '<p><b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo '</p>'; *************** *** 537,541 **** // Add the AnsVars field, isnce this may now be used. $qfield='questionAnsVarsRaw'; ! echo '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; $strout = ''; if (array_key_exists($qfield,$question)) { --- 316,320 ---- // Add the AnsVars field, isnce this may now be used. $qfield='questionAnsVarsRaw'; ! echo '<b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; $strout = ''; if (array_key_exists($qfield,$question)) { *************** *** 559,573 **** $qfield='questionSol'; ! echo '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "\n\n<br />\n"; $qfield='questionNote'; ! echo '<b>'.stack_question_edit_dispquestionfield($qfield).'</b><br />'; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "\n\n<br />\n"; // Buttons to go somewhere next ! if ($stack_stand_alone) { echo "<p><a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; if (''==$errors) { --- 338,352 ---- $qfield='questionSol'; ! echo '<b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "\n\n<br />\n"; $qfield='questionNote'; ! echo '<b>'.stack_question_edit_dispquestionfield($qfield,$remoteCaller).'</b><br />'; @stack_question_edit_form_field($qfield,$question[$qfield],$errors); echo "\n\n<br />\n"; // Buttons to go somewhere next ! if (!$remoteCaller) { echo "<p><a href=\"javascript:EditQ('edit')\">Edit question</a> \n"; if (''==$errors) { *************** *** 585,589 **** $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); ! stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions'); echo "\n<hr />\n"; --- 364,368 ---- $options_list = array('InsertStars','InformalSyntax','AllowInputTool','SyntaxHint','Forbid','Allow','MarkModMethod','FeedBackGenericCorrect','FeedBackGenericPCorrect','FeedBackGenericIncorrect','Display'); ! stack_options_edit_form($options_headings,$options_list,$optval,'questionOptions',$remoteCaller); echo "\n<hr />\n"; *************** *** 592,598 **** $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); ! stack_question_metadata_edit_form($question,$metadata_list); //Create all metadata fields on question form echo "\n<hr />\n"; } // end of edit_form_table --- 371,390 ---- $metadata_list = array('questionLanguage','questionLearningContext','questionDifficulty','questionCompetency', 'questionCompetencyLevel','questionTimeAllocated','questionExcerciseType','questionRights'); ! stack_question_metadata_edit_form($question,$metadata_list,$remoteCaller); //Create all metadata fields on question form echo "\n<hr />\n"; + + $html = ob_get_contents(); + + if (!$remoteCaller) { + ob_end_flush(); + } + + //Do not ask server to display options, waste of processor power + else { + ob_end_clean(); + } + + return $html; } // end of edit_form_table *************** *** 649,664 **** /** ! * Display the name of a questionField, in a link generating a popup window. * * @param string $field The field name * @return string The link to the popup window */ ! function stack_question_edit_dispquestionfield($field) { global $stackQuestion; $fd='stackQuestion_'.$field; $fd=get_string($fd,'stack',''); ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuestion');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); } --- 441,467 ---- /** ! * Display the name of a questionField. Behaviour depends on whether remoteCaller is set ! * If remoteCaller=false, generate help for field with popup link ! * If remoteCaller=true, generate just the question string * * @param string $field The field name * @return string The link to the popup window */ ! function stack_question_edit_dispquestionfield($field,$remoteCaller=false) { global $stackQuestion; $fd='stackQuestion_'.$field; $fd=get_string($fd,'stack',''); ! ! if(!$remoteCaller) ! { ! $strout = "<a border=\"none\" href=\"javascript:HelpPopup('$field','stackQuestion');\"><img align=\"middle\" border=\"0\" alt=\"$fd\" src=\"pics/help.gif\" /></a> $fd"; ! return($strout); ! } ! ! else ! { ! return($fd); ! } } *************** *** 1198,1202 **** * @return void */ ! function stack_question_metadata_edit_form($question,$metadata_list) { global $stackQuestion; --- 1001,1005 ---- * @return void */ ! function stack_question_metadata_edit_form($question,$metadata_list,$remoteCaller=FALSE) { global $stackQuestion; *************** *** 1210,1214 **** //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; --- 1013,1017 ---- //Iterate through each field given in $metadata_list foreach( $metadata_list as $k => $metadata) { ! $descript = stack_question_edit_dispquestionfield($metadata,$remoteCaller); //Display tag with help $fieldname= $metadata; Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** stackXML.php 29 Aug 2005 19:08:04 -0000 1.16 --- stackXML.php 30 Aug 2005 10:28:01 -0000 1.17 *************** *** 1743,1746 **** --- 1743,1837 ---- $schemaSequence->appendChild($schemaField); + + if (!empty($optionField['type'])) + { + switch($optionField['type']) + { + case('list'): + { + //List type takes the lower case of the field + if (!empty($optionField['minoccurs']) && (!empty($optionField['maxoccurs']))) + { + $schemaField = &stack_xml_create_schema_field($arrayKey, FALSE, strtolower($arrayKey), + $optionField['minoccurs'], $optionField['maxocurrs']); + } + + else + { + $schemaField = &stack_xml_create_schema_field($arrayKey, FALSE, strtolower($arrayKey)); + } + + //<TODO>If of list type we should also output the list of possible values into the schema root + $schemaSimpleType = &stack_xml_create_schema_vocabulary(strtolower($arrayKey),$optionField['values']); + + $schemaElem->appendChild($schemaSimpleType); + + break; + } + + case('number'): + { + //Output of type xs:float + if (!empty($optionField['minoccurs']) && (!empty($optionField['maxoccurs']))) + { + $schemaField = &stack_xml_create_schema_field($arrayKey, TRUE, 'FLOAT', + $optionField['minoccurs'], $optionField['maxocurrs']); + } + + else + { + $schemaField = &stack_xml_create_schema_field($arrayKey, TRUE, 'FLOAT'); + } + + break; + } + + case('html' || 'string' ): + { + //Output type xs:string + if (!empty($optionField['minoccurs']) && (!empty($optionField['maxoccurs']))) + { + $schemaField = &stack_xml_create_schema_field($arrayKey, TRUE, 'TEXT', + $optionField['minoccurs'], $optionField['maxocurrs']); + } + + else + { + $schemaField = &stack_xml_create_schema_field($arrayKey, TRUE, 'TEXT'); + } + + break; + } + + default: + { + if (!empty($optionField['minoccurs']) && (!empty($optionField['maxoccurs']))) + { + $schemaField = &stack_xml_create_schema_field($arrayKey, TRUE, 'TEXT', + $optionField['minoccurs'], $optionField['maxocurrs']); + } + + else + { + $schemaField = &stack_xml_create_schema_field($arrayKey, TRUE, 'TEXT'); + } + + break; + } + } + + //Now add any documentation to the field + if (!empty($optionField['doc'])) + { + stack_xml_create_field_documentation($schemaField,$optionField['doc']); + } + } + + else + { + echo("<b>Developer notice:</b>The field $optionField does not have a type associated with it and will not be written out<br>"); + } + + $schemaSequence->appendChild($schemaField); } Index: stackQuestion.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackQuestion.php,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** stackQuestion.php 25 Aug 2005 16:15:07 -0000 1.32 --- stackQuestion.php 30 Aug 2005 10:28:01 -0000 1.33 *************** *** 2161,2163 **** --- 2161,2198 ---- } + /** + * Creates a new question with the mimimum fields + * + * @param void + * @return array $question Question with the mimimum fields + */ + function stack_question_new($remoteUser='') + { + global $user, $stack_web_url; + + $question=''; + + $question['questionID'] = '0'; + $question['questionAnsKey'] = 'ans1'; + $question['questionGUID'] = stack_generate_guid($stack_web_url); + $question['questionFormat'] = 'text/xml; charset="utf-8"'; + $question['questionPublisher'] = $stack_web_url; + $question['type'] = 'question'; + + if (empty($remoteUser)) { + $question['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; + + if ($user['email']!='') { //<TODO: need to somehow retrieve the RQP user who is making new question + $question['questionUserLastEdited'].=' <'.$user['email'].'>'; + } + } + + else + { + $question['questionUserLastEdited'] = $remoteUser; + } + + return $question; + } + ?> |
From: Chris S. <san...@us...> - 2005-08-30 09:43:05
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27478/scripts Modified Files: stackWin.php Log Message: Index: stackWin.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackWin.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** stackWin.php 26 Aug 2005 08:57:42 -0000 1.11 --- stackWin.php 30 Aug 2005 09:42:42 -0000 1.12 *************** *** 92,96 **** if(is_resource($CASProcess)) { ! if (!fwrite($pipes[0], $stack_cas['initCommand'])) { echo "<br />Could not write to the CAS process!<br/ >\n"; --- 92,99 ---- if(is_resource($CASProcess)) { ! if ($debug) { ! echo "<b>CAS started.</b></br>"; ! } ! if (!fwrite($pipes[0], $stack_cas['initCommand'])) { echo "<br />Could not write to the CAS process!<br/ >\n"; *************** *** 101,105 **** fflush($pipes[0]); - //echo "<pre>".$strin."</pre>"; $ret = ''; --- 104,107 ---- |
From: Chris S. <san...@us...> - 2005-08-30 09:43:05
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27478 Modified Files: stackConfig.php.dist Log Message: Index: stackConfig.php.dist =================================================================== RCS file: /cvsroot/stack/stack-1-0/stackConfig.php.dist,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** stackConfig.php.dist 29 Aug 2005 19:08:04 -0000 1.4 --- stackConfig.php.dist 30 Aug 2005 09:42:42 -0000 1.5 *************** *** 83,87 **** // In windows, you should edit the batch scripts/install/stackmaxima.bat // and place it in your windows PATH. ! $stack_cas['command'] = 'stackmaxima'; } else { $stack_cas['command'] = 'maxima'; --- 83,88 ---- // In windows, you should edit the batch scripts/install/stackmaxima.bat // and place it in your windows PATH. ! //$stack_cas['command'] = 'stackmaxima'; ! $stack_cas['command'] = $stack_root.'\scripts\install\stackmaxima.bat'; } else { $stack_cas['command'] = 'maxima'; |
From: pkiddie <pk...@us...> - 2005-08-29 21:51:31
|
Update of /cvsroot/stack/stack-1-0/scripts/rqp In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18141/scripts/rqp Modified Files: Tag: development_rqp RQPv1p0Server.php nb_soapfuncs.php Log Message: New version of SOAP functions to return SOAP errors where necessary Index: RQPv1p0Server.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/RQPv1p0Server.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** RQPv1p0Server.php 26 Aug 2005 17:36:50 -0000 1.2.2.1 --- RQPv1p0Server.php 29 Aug 2005 21:51:21 -0000 1.2.2.2 *************** *** 60,63 **** --- 60,65 ---- $stack_ver['cvsmodule'] = 'stack-1-0'; + $stack_web_services_provide = TRUE; + // "Insert *s where needed"; $stackOptions['InsertStars']['type'] = 'list'; *************** *** 209,213 **** { include("../../stackstd.php"); //Reqd for version info for STACK ! global $stack_ver, $stack_web_url; // return new nbSOAPFault("unimplemented", "The RQP_ServerInformationservice has not been implemented yet", ""); $si['type'] = "STACK"; --- 211,220 ---- { include("../../stackstd.php"); //Reqd for version info for STACK ! global $stack_ver, $stack_web_url, $stack_web_services_provide; ! ! if (!$stack_web_services_provide) { ! return new nbSOAPFault("notImplemented", "The RQP_ServerInformation service is not available on this server"); ! } ! // return new nbSOAPFault("unimplemented", "The RQP_ServerInformationservice has not been implemented yet", ""); $si['type'] = "STACK"; *************** *** 239,242 **** --- 246,254 ---- function RQP_ItemInformation($source) { + global $stack_web_services_provide; + + if (!$stack_web_services_provide) { + return new nbSOAPFault("notImplemented", "The RQP_ItemInformation service is not available on this server"); + } //First we check to see if the source intantiates a valid question, if so set isValid to true *************** *** 315,319 **** */ function RQP_Render($source, $options, &$persistentData, $inputData, $directives, $mimetypes, $namePrefix, $itemBase, $resourceBase, $tempfileBase) ! { require("../../stackstd.php"); //Reqd for version info for STACK //require("../moodlelib.php"); --- 327,337 ---- */ function RQP_Render($source, $options, &$persistentData, $inputData, $directives, $mimetypes, $namePrefix, $itemBase, $resourceBase, $tempfileBase) ! { ! global $stack_web_services_provide; ! ! if (!$stack_web_services_provide) { ! return new nbSOAPFault("notImplemented", "The RQP_ServerInformation service is not available on this server"); ! } ! require("../../stackstd.php"); //Reqd for version info for STACK //require("../moodlelib.php"); Index: nb_soapfuncs.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/rqp/nb_soapfuncs.php,v retrieving revision 1.2.2.1 retrieving revision 1.2.2.2 diff -C2 -d -r1.2.2.1 -r1.2.2.2 *** nb_soapfuncs.php 26 Aug 2005 17:36:50 -0000 1.2.2.1 --- nb_soapfuncs.php 29 Aug 2005 21:51:21 -0000 1.2.2.2 *************** *** 65,71 **** $startTime = time(); $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) --- 65,77 ---- $startTime = time(); $sock = fsockopen($urldata['host'],$urldata['port'], $errno, $errmsg, $timeLimit); + if($sock==FALSE) + { + $fault = new nbSOAPFault("Server", "Timed out trying to contact server.", "No response from server."); + $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; + return nbSOAP_Envelope($fault); + } stream_set_timeout($sock, 2); stream_set_blocking($sock, false); ! //echo "<pre>".htmlentities($request)."</pre>"; // Uncomment this for debugging if($sock == false) *************** *** 85,98 **** $cl = strlen($contents); $contents .= fread($sock, 8192); ! /* if(!$headersComplete) { ! $headerEnd = strpos($contents,"\r\n\r\n"); ! if($headerEnd != false) { ! $headersComplete = true; ! $clp = strpos($contents,"Content-Length:"); ! $cle = strpos($contents,"\r\n",$clp); ! $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); ! $headerLength = $cle+4; } } --- 91,123 ---- $cl = strlen($contents); $contents .= fread($sock, 8192); ! if(!$headersComplete) { ! //# remove any leading continues ! $headerEnd = strpos($contents,"\r\n\r\n"); ! while(($headerEnd != false)&&(!$headersComplete)) { ! $fle = strpos($contents,"\r\n"); // first line end ! $line = substr($contents, 0, $fle); ! list($protocol, $rcode) = split(" ", $line, 3); ! $rcode = intval($rcode); // ensure its an integer; ! if(($rcode >= 100)&&($rcode <= 199)) // informational, I'm not interested ! { ! $contents = substr($contents, $headerEnd+4); ! $headerEnd = strpos($contents,"\r\n\r\n"); ! } ! elseif($rcode == 200) ! { ! $headersComplete = true; ! $clp = strpos($contents,"Content-Length:"); ! $cle = strpos($contents,"\r\n",$clp); ! $contentLength = intval(trim(substr($contents, $clp+15, $cle-$clp-15))); ! $headerLength = $cle+4; ! } ! else ! { ! $fault = new nbSOAPFault("Server", "An http error was returned, http code $rcode", "An http error was returned, http code $rcode"); ! $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; ! return nbSOAP_Envelope($fault); ! } } } *************** *** 101,113 **** if(strlen($contents)>=$contentLength+$headerLength) $pageComplete = true; ! } */ $callTime = time()-$startTime; if($callTime >= $timeLimit) $pageComplete = true; ! echo "<p><i><pre>[" . htmlentities($contents) . "]</pre></i></p>"; } fclose($sock); } ! echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } --- 126,143 ---- if(strlen($contents)>=$contentLength+$headerLength) $pageComplete = true; ! } $callTime = time()-$startTime; if($callTime >= $timeLimit) + { $pageComplete = true; ! $fault = new nbSOAPFault("Server", "Timed out calling server.", "No response, or an incomplete response before the request timed out."); ! $fault = "<soap:Body>\n" . $fault->soapify() . "</soap:Body>\n"; ! return nbSOAP_Envelope($fault); ! } ! //echo "<p><i><pre>[" . htmlentities($contents) . "]</pre></i></p>"; } fclose($sock); } ! //echo "<pre>" . htmlentities($contents) . "</pre>"; // Uncomment this for debugging return $contents; } |
From: Chris S. <san...@us...> - 2005-08-29 19:08:20
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15577 Modified Files: editquiz.php import.php question_bank.php stackConfig.php.dist Log Message: Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/import.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** import.php 29 Aug 2005 18:41:03 -0000 1.5 --- import.php 29 Aug 2005 19:08:04 -0000 1.6 *************** *** 35,43 **** require_once('stackLib.php'); require_once("{$stack_root}/html/trypopupform.html"); - require_once("{$stack_root}/frontend_general/editquiz_display.php"); require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/quizjava.html"); - require_once("{$stack_root}/scripts/stackAuthor.php"); $default_action = 'import'; --- 35,43 ---- require_once('stackLib.php'); + require_once("{$stack_root}/scripts/stackAuthor.php"); + require_once("{$stack_root}/html/trypopupform.html"); require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/quizjava.html"); $default_action = 'import'; Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** question_bank.php 29 Aug 2005 18:41:03 -0000 1.12 --- question_bank.php 29 Aug 2005 19:08:04 -0000 1.13 *************** *** 139,143 **** include_once("{$stack_root}/scripts/stackXML.php"); stack_question_validate($question,$errors); ! $name = stack_xml_write_question_file($question, "{$stack_root}/tmp/"); $questions_to_export = TRUE; } --- 139,143 ---- include_once("{$stack_root}/scripts/stackXML.php"); stack_question_validate($question,$errors); ! $name = stack_xml_write_question_file($question, "{$stack_root}/{$stack_tmpdir}/"); $questions_to_export = TRUE; } *************** *** 148,152 **** $name = ''; if (NULL !== $questions_to_export) { ! $name = stack_xml_write_question_list($questions_to_export, "{$stack_root}/tmp/"); } $action = 'export_xml'; --- 148,152 ---- $name = ''; if (NULL !== $questions_to_export) { ! $name = stack_xml_write_question_list($questions_to_export, "{$stack_root}/{$stack_tmpdir}/"); } $action = 'export_xml'; Index: stackConfig.php.dist =================================================================== RCS file: /cvsroot/stack/stack-1-0/stackConfig.php.dist,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** stackConfig.php.dist 29 Aug 2005 18:41:03 -0000 1.3 --- stackConfig.php.dist 29 Aug 2005 19:08:04 -0000 1.4 *************** *** 41,44 **** --- 41,48 ---- $stack_web_url = 'http://'.$stack_host.'/'.$stack_basepath.'/'; + /* Temporary files, such as pictures and XML */ + /* This should be in $stack_root */ + $stack_tmpdir = 'tmp'; + /***************************************************/ /* Integration with VLE or stand alone? */ *************** *** 102,107 **** // Use UNIX slashes in filenames: these get sorted in initmaxima.php, for Windows $maximalocal['TMP_IMAGE_DIR'] = $stack_logfiles; ! $maximalocal['IMAGE_DIR'] = $stack_root.'/tmp/'; ! $maximalocal['URL_BASE'] = $stack_web_url.'tmp/'; // These are used by the GNUplot "set terminal" command. $maximalocal['PLOT_TERMINAL'] = 'png'; // Either 'png' or 'gif' --- 106,111 ---- // Use UNIX slashes in filenames: these get sorted in initmaxima.php, for Windows $maximalocal['TMP_IMAGE_DIR'] = $stack_logfiles; ! $maximalocal['IMAGE_DIR'] = $stack_root.'/'.$stack_tmpdir.'/'; ! $maximalocal['URL_BASE'] = $stack_web_url.$stack_tmpdir.'/'; // These are used by the GNUplot "set terminal" command. $maximalocal['PLOT_TERMINAL'] = 'png'; // Either 'png' or 'gif' Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** editquiz.php 29 Aug 2005 18:41:03 -0000 1.17 --- editquiz.php 29 Aug 2005 19:08:04 -0000 1.18 *************** *** 43,49 **** require_once("{$stack_root}/html/quizjava.html"); - //require_once("{$stack_root}/frontend_general/editquiz_display.php"); - //include_once('frontend_general/edit_quiz_util.php'); - /////////////////////////////////////////////////////////////// // (1) Process Input - this sets $action, $user and $username --- 43,46 ---- *************** *** 178,182 **** $quiz = stack_db_quiz_get($quizid); stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata ! $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); } --- 175,179 ---- $quiz = stack_db_quiz_get($quizid); stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata ! $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/{$stack_tmpdir}/"); } |
From: Chris S. <san...@us...> - 2005-08-29 19:08:20
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15577/scripts Modified Files: stackXML.php Log Message: Index: stackXML.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackXML.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** stackXML.php 25 Aug 2005 16:25:41 -0000 1.15 --- stackXML.php 29 Aug 2005 19:08:04 -0000 1.16 *************** *** 29,38 **** //$namespaces data structure ! $namespaces['xs']['namespace'] = 'http://www.w3.org/2001/XMLSchema'; //Default namespace ! $namespaces['xs']['id'] = 'xs'; //REQUIRED FOR SCHEMA ! $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. [...4023 lines suppressed...] ! global $stackQuiz; ! ! foreach ($stackQuiz as $arrayKey=>$quizField) //Iterate through the master stackQuestion fields ! { ! if (!array_key_exists($arrayKey,$quiz)) //Where the field ocurrs in stackQuiz, but not the imported quiz ! { //and is metadata ! if(!empty($quizField['type']) && ($quizField['type']=='meta')) ! { ! //If metadata field has defaults ! if(!empty($quizField['default'])) ! { ! //Set the field in $question to the default metadata ! $quiz[$arrayKey]=$quizField['default']; ! } ! ! } ! } ! } } ?> |
From: Chris S. <san...@us...> - 2005-08-29 18:41:18
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9530/scripts Modified Files: stackUser.php Added Files: stackFrontend.php Log Message: Index: stackUser.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackUser.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** stackUser.php 25 Aug 2005 16:06:17 -0000 1.13 --- stackUser.php 29 Aug 2005 18:41:03 -0000 1.14 *************** *** 67,70 **** --- 67,83 ---- } + /** + * Returns TRUE if the user is the guest user, FALSE otherwise + * @param $user, The user + * @return bool + */ + function stack_user_is_guest($user) { + if ('guest' == $user['username']) { + return TRUE; + } else { + return FALSE; + } + } + /** * Build the STACK admin user *************** *** 89,92 **** --- 102,118 ---- /** + * Returns TRUE if the user is the admin user, FALSE otherwise + * @param $user, The user + * @return bool + */ + function stack_user_is_admin($user) { + if ('admin' == $user['username']) { + return TRUE; + } else { + return FALSE; + } + } + + /** * Return a valid $user array, having checked usernames and passwords. * Has to cope with two special users: 'guest' and 'admin' *************** *** 136,139 **** --- 162,177 ---- } + /** + * Returns TRUE if the user is logged in, FALSE otherwise + * @param $user, The user + * @return bool + */ + function stack_is_logged_in($user) { + if ($user['loggedin']) { + return TRUE; + } else { + return FALSE; + } + } /** *************** *** 157,161 **** } $user['id'] = $userID; ! stack_user_information_validate($user,$errors); --- 195,199 ---- } $user['id'] = $userID; ! stack_user_information_validate($user,$errors); *************** *** 164,169 **** $mysqlrow = stack_db_user_update($user); } else { ! $errors['user']['password'] = '<font color="red">Password must be non-empty.</font>'; ! $error = $errors['user']['password']; $action = 'error'; } --- 202,206 ---- $mysqlrow = stack_db_user_update($user); } else { ! $errors['user']['password'] = '<font color="red">'.get_string('EmptyPassword','stack','').'</font>'; $action = 'error'; } *************** *** 204,212 **** if (array_key_exists('password1',$user)) { ! if ('' != $user['password1'] and '' !=$user['password2']) { if ( $user['password1'] == $user['password2']) { $user['password'] = $user['password1']; // HACK: should be md5($user['password1']); } else { ! $errors['user']['password'] = '<font color="red">'.get_string('MisMatchPassword','stack','').'</font>'.get_string('OldPasswordUnch','stack',''); } } --- 241,249 ---- if (array_key_exists('password1',$user)) { ! if ('' != trim($user['password1']) and '' != trim($user['password2'])) { if ( $user['password1'] == $user['password2']) { $user['password'] = $user['password1']; // HACK: should be md5($user['password1']); } else { ! $errors['user']['password'] = '<font color="red">'.get_string('MisMatchPassword','stack','').'</font> '.get_string('OldPasswordUnch','stack',''); } } *************** *** 216,221 **** $errors['user']['password'] = '<font color="red">'.get_string('QValidRequiredField','stack','').'</font>'; } - - } --- 253,256 ---- *************** *** 276,283 **** if ($admin) { $pswd = $user['password']; ! echo '<tr><td>'.get_string('USR_NewPassword','stack','').'</td><td><input type="text" name="user[password1]" size="15" value="'.$pswd.'" alt="Password" /></td></tr>'; echo '<tr><td>'.get_string('USR_ConfirmPsswd','stack','').'</td><td><input type="text" name="user[password2]" size="15" value="'.$pswd.'" alt="Confirm Password" /></td></tr>'; } else { ! echo '<tr><td>'.get_string('USR_NewPassword','stack','').'</td><td><input type="password" name="user[password1]" size="15" value="" alt="Password" /></td></tr>'; echo '<tr><td>'.get_string('USR_ConfirmPsswd','stack','').'</td><td><input type="password" name="user[password2]" size="15" value="" alt="Confirm Password" /></td></tr>'; } --- 311,318 ---- if ($admin) { $pswd = $user['password']; ! echo '<tr><td>'.get_string('USR_NewPassword','stack','').'</td><td><input type="text" name="user[password1]" size="15" value="'.$pswd.'" alt="Password" /></td><td>'.nsf($err,'password').'</td></tr>'; echo '<tr><td>'.get_string('USR_ConfirmPsswd','stack','').'</td><td><input type="text" name="user[password2]" size="15" value="'.$pswd.'" alt="Confirm Password" /></td></tr>'; } else { ! echo '<tr><td>'.get_string('USR_NewPassword','stack','').'</td><td><input type="password" name="user[password1]" size="15" value="" alt="Password" /></td><td>'.nsf($err,'password').'</td></tr>'; echo '<tr><td>'.get_string('USR_ConfirmPsswd','stack','').'</td><td><input type="password" name="user[password2]" size="15" value="" alt="Confirm Password" /></td></tr>'; } --- NEW FILE: stackFrontend.php --- <?php /** * Functions for the front end. * * @package stackFrontend * @subpackage Stack */ /** * Gets the questionbank filter if this has been set. * TO DO: This also sets $SESSION['bank_filter']. This should really * be in a separate function. Also should have a $source parameter * @return array question_bank_filter The Question Bank Filter */ function stack_questionbank_filter_get() { // Ensure all fields exist and are set. $question_bank_filter['name'] = ''; $question_bank_filter['kw'] = ''; $question_bank_filter['case_sense'] = TRUE; $question_bank_filter['show_descript'] = FALSE; $question_bank_filter['any'] = 'Any'; $question_bank_filter['order1'] = 'questionName'; $question_bank_filter['order2'] = 'questionKeywords'; $question_bank_filter['order3'] = 'questionID'; if (array_key_exists('bank_filter',$_SESSION)) { $question_bank_filter = $_SESSION['bank_filter']; } if (array_key_exists('bank_filter',$_POST)) { $question_bank_filter = $_POST['bank_filter']; if (!array_key_exists('case_sense',$question_bank_filter)) { $question_bank_filter['case_sense'] = FALSE; } if (!array_key_exists('show_descript',$question_bank_filter)) { $question_bank_filter['show_descript'] = FALSE; } } $_SESSION['bank_filter'] = $question_bank_filter; return $question_bank_filter; } /** * Gets the question instance that has been stored in $_POST * @param string $source. Must be 'database', 'new' or 'default' * @return array $questionInst Quiz question */ function stack_question_get($source) { global $stack_web_url,$user; $question = NULL; // $_POSTED data should over write any $_SESSION data, as it may have been // entered in a form. if ('default' == $source) { $question = stack_get_question_from_session(); if (array_key_exists('questionID',$_POST)) { $question = stack_get_question_from_post(); } } else if ('database' == $source) { $questionID = $_POST['questionID']; $question = stack_db_getquestion($questionID); } if ('new' == $source or NULL == $question) { //show_array($user); $question['questionID'] = '0'; $question['questionAnsKey'] = 'ans1'; $question['questionGUID'] = stack_generate_guid($stack_web_url); $question['questionFormat'] = 'text/xml; charset="utf-8"'; $question['questionPublisher'] = $stack_web_url; $question['type'] = 'question'; $question['questionUserLastEdited'] = $user['firstname']." ".$user['lastname']; if ($user['email']!='') { $question['questionUserLastEdited'].=' <'.$user['email'].'>'; } } return $question; } /** * Gets the question instance that has been stored in the session * @return array $questionInst Quiz question instance */ function stack_get_questionInst() { $questionInst = NULL; // Get any $questionInst from the current $_SESSION if (array_key_exists('questionInst',$_SESSION)) { $questionInst=$_SESSION['questionInst']; unset($_SESSION['questionInst']); } return $questionInst; } /** * Gets the question that has been stored in the session * @return array $question Quiz question */ function stack_get_question_from_session() { global $stackQuestion; $question = NULL; // Get any $question from the current $_SESSION if (array_key_exists('question',$_SESSION)) { foreach ($stackQuestion as $qfield => $val) { if (array_key_exists($qfield,$_SESSION['question'])) { if ('' != $_SESSION['question'][$qfield]) { $question[$qfield] = $_SESSION['question'][$qfield]; } } } unset($_SESSION['question']); } return $question; } /** * Gets the question instance that has been stored in $_POST * @return array $questionInst Quiz question */ function stack_get_question_from_post() { global $stackQuestion; $question = NULL; foreach($stackQuestion as $qfield => $attribs) { if (array_key_exists($qfield,$_POST) ) { if ('questionOptions' == $qfield) { $question[$qfield] = $_POST[$qfield]; } else if ('questionPotResp' == $qfield ) { $question[$qfield] = $_POST[$qfield]; } else if ( '' !=trim($_POST[$qfield]) ) { // We need this: all fields on form will be present in $_POST. $question[$qfield] = $_POST[$qfield]; } } } return $question; } /** * Gets the selected questions * @return array $quiz The questions selected */ function stack_get_selected_questions() { $quiz = NULL; if (array_key_exists('checked',$_POST)) { if (is_array($_POST['checked'])) { foreach ($_POST['checked'] as $quID => $val) { if ('ticked' == $val) { $quiz[] = $quID; } } } } return $quiz; } /** * Gets the seed variable that should be used * @return array $seed The seed variable */ function stack_get_seed() { if (array_key_exists('seed',$_POST)) { $seed=$_POST['seed']; } else { // HACK: this should involve the concept of a user! $seed = time(); } return $seed; } /** * Displays the edit metadate form * @param array $question_bank_filter The question bank filter to apply * @return void */ function stack_display_qb_edit_metadata($question_bank_filter) { global $stack_root; include("{$stack_root}/html/qselectform.php"); stack_db_listquestions('edit_metadata',$question_bank_filter); echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; } /** * Displays the preview of a question * @return void */ function stack_display_qb_preview($questionInst) { echo "<center><table bgcolor='#CCCCCC' width='100%' cellpadding='2'> <td align='left'> <b>Question: ".sf($questionInst,'questionName')."</b> (".sf($questionInst,'questionID'); echo ")</td><td align='right'>"; echo "<a href=\"javascript:HelpPopup('student','');\">Help</a></td></tr></table></center>"; } /** * Displays the list of quizzes for the admin to edit * @param array $quizstore The store of quizzes * @param string $PostTo The page that the info from the form should be posted to * @return void */ function stack_quiz_selectform($quiz_store, $PostTo) { global $stackQuiz,$stack_web_url; if (is_array($quiz_store)) { echo "<p>\n<form name='quiztryform' action='{$stack_web_url}quiz.php' method='POST'> <input type='hidden' name='quizid' value='-1' /> <input type='hidden' name='action' value='quiz_choose' /></form>"; echo "<p>\n<form name='quizform' action='$PostTo' method='POST'> <input type='hidden' name='quizid' value='-1' /> <input type='hidden' name='action' value='quiz_choose' />"; echo "\n<table cellpadding='2'>\n"; echo "\n<tr><th></th><th>{$stackQuiz['quizName']['descript']}</th> <th>{$stackQuiz['quizDescription']['descript']}</th><th></th></tr>"; foreach ($quiz_store as $qs => $quiz) { $qname = $quiz['quizName']; if ('' == trim($qname)) { $qname = '[empty]'; } $qID = $quiz['quizid']; echo "<tr><td>{$qID}</td><td>{$qname}</td><td>".$quiz['quizDescription']."</td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_edit','$qID');\">edit</a></td>\n"; echo "<td><a href=\"javascript:quiztry('continue_quiz','$qID');\">try</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_report','$qID');\">results</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_xml','$qID');\">xml</a></td>\n"; echo "<td><a href=\"javascript:takeaction('quiz_delete','$qID');\"><font color='red'>del</font></a></td></tr>\n"; } echo "\n</table>\n\n</p></form>"; } else { echo "<p>You have no quizzes available to try.</p>"; echo "<p>\n<form name='quizform' action='$PostTo' method='POST'> <input type='hidden' name='quizid' value='-1' /> <input type='hidden' name='action' value='quiz_choose' />"; } } ?> |
From: Chris S. <san...@us...> - 2005-08-29 18:41:15
|
Update of /cvsroot/stack/stack-1-0/lang/en In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9530/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.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** stack.php 26 Aug 2005 15:33:43 -0000 1.23 --- stack.php 29 Aug 2005 18:41:03 -0000 1.24 *************** *** 123,127 **** --- 123,129 ---- $string['IncorrectPassword'] = 'Incorrect password!'; $string['UnknownUserName'] = 'Username does not exist!'; + $string['NoUserNameGiven'] = 'No username was supplied'; $string['MisMatchPassword'] = 'Your two passwords did not match!'; + $string['EmptyPassword'] = 'Password must be non-empty.'; $string['OldPasswordUnch'] = 'Your old password (if any) is unchanged.'; |
From: Chris S. <san...@us...> - 2005-08-29 18:41:12
|
Update of /cvsroot/stack/stack-1-0 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9530 Modified Files: analysis.php chat.php chat_mathml.php documentation.php editquiz.php import.php index.php question_bank.php quiz.php stackConfig.php.dist stackLib.php user.php Log Message: Index: import.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/import.php,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** import.php 29 Aug 2005 15:35:22 -0000 1.4 --- import.php 29 Aug 2005 18:41:03 -0000 1.5 *************** *** 33,36 **** --- 33,37 ---- session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); require_once("{$stack_root}/html/trypopupform.html"); Index: quiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/quiz.php,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** quiz.php 29 Aug 2005 15:35:22 -0000 1.30 --- quiz.php 29 Aug 2005 18:41:03 -0000 1.31 *************** *** 14,17 **** --- 14,18 ---- session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); $default_action = 'choose_quiz'; Index: index.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/index.php,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** index.php 29 Aug 2005 15:35:22 -0000 1.26 --- index.php 29 Aug 2005 18:41:03 -0000 1.27 *************** *** 16,26 **** * @author Chris Sangwin C.J...@bh... * @author Laura Naismith L.N...@bh... ! ! * ! * This file contains the front end logic for the main frontend pages ! * TO DO: Some of the code in this file needs to be factored out into separate ! * algorithms- ideally we should have a function for each action on entry and ! * for display. ! * - Added logic to view installation instructions if stackConfig.php not dectected * @package Stack */ --- 16,20 ---- * @author Chris Sangwin C.J...@bh... * @author Laura Naismith L.N...@bh... ! * * @package Stack */ *************** *** 32,39 **** session_start(); - /////////////////////////////////////////////////////////////// - // (1) Process Input - this sets $action, $user and $username - /////////////////////////////////////////////////////////////// - if (file_exists('stackConfig.php')) { require_once('stackConfig.php'); --- 26,29 ---- *************** *** 44,69 **** die(); } $default_action = 'loginscreen'; - include_once($stack_root.'/frontend_general/front_end_display.php'); include($stack_root.'/frontend_general/process_input.php'); ! //Initialisation include_once("{$stack_root}/scripts/stackXML.php"); ! //1. Check that XML schemas are up to date ! if (!stack_xml_check_schema_version(schemaBaseDir)) ! { ! $action = 'update_schema'; } ! //2. Check whether database needs updating - need to be logged in to get credentials include_once("{$stack_root}/scripts/stackDatabase.php"); ! if (!stack_db_database_update() && stack_is_logged_in($user) and !stack_user_is_guest($user)) ! { ! $action = 'update_db'; } /////////////////////////////////////////////////////////////// ! // (2) Take any actions required /////////////////////////////////////////////////////////////// --- 34,67 ---- die(); } + require_once('stackLib.php'); + + /////////////////////////////////////////////////////////////// + // (1) Process Input - this sets $action, $user and $username + /////////////////////////////////////////////////////////////// + + require_once($stack_root.'/scripts/stackFrontend.php'); $default_action = 'loginscreen'; include($stack_root.'/frontend_general/process_input.php'); ! /////////////////////////////////////////////////////////////// ! // (2) Check if updates are needed ! /////////////////////////////////////////////////////////////// ! ! ! // 2.1 Check that XML schemas are up to date include_once("{$stack_root}/scripts/stackXML.php"); ! if (!stack_xml_check_schema_version(schemaBaseDir)) { ! $action = 'update_schema'; } ! // 2.2 Check whether database needs updating - need to be logged in to get credentials include_once("{$stack_root}/scripts/stackDatabase.php"); ! if (!stack_db_database_update() && stack_is_logged_in($user) and !stack_user_is_guest($user)) { ! $action = 'update_db'; } /////////////////////////////////////////////////////////////// ! // (3) Take any actions required /////////////////////////////////////////////////////////////// *************** *** 107,116 **** switch ($action) { case 'loginscreen': ! stack_display_main_login($username, $errun, $errps); ! break; ! case 'registration_screen': ! include_once($stack_root."/scripts/stackUser.php"); ! stack_display_main_register($username, $user, $errors, $err); ! break; case 'update_info': if (stack_is_logged_in($user) and !stack_user_is_guest($user)) { --- 105,128 ---- switch ($action) { case 'loginscreen': ! echo '<h1>Login</h1><form action="index.php" method="post" name="login" id="login"><table><tr><td align="right">Username:</td>'; ! echo "<td><input type=\"text\" name=\"username\" size=\"15\" value=\"{$username}\" alt=\"Username\" /></td><td>".$errun.'</td>'; ! echo '</tr><tr><td>Password:</td>'; ! echo '<td><input type="password" name="password" size="15" value="" alt="Password" /></td><td>'.$errps.'</td>'; ! echo '</tr><tr><td> ! <input type="hidden" name="action" value="login" /> ! <input type="submit" value="Login" /> ! </td></tr> ! </table></form>'; ! ! echo 'You may login with the username "guest" and an empty password.'; ! ! echo '<form action="index.php" method="post" name="guestlogin"> ! Register with this STACK sever: ! <input type="hidden" name="username" value="guest" /> ! <input type="hidden" name="password" value="guest" /> ! <input type="hidden" name="action" value="registration_screen" /> ! <input type="submit" value="Register" /> ! </form>'; ! break; case 'update_info': if (stack_is_logged_in($user) and !stack_user_is_guest($user)) { *************** *** 121,126 **** } break; ! case 'error': ! echo "There was an error with the login or registration"; break; case 'choose_quiz': --- 133,146 ---- } break; ! case 'registration_screen': ! include_once($stack_root."/scripts/stackUser.php"); ! ! echo "<h1>Register as a new user</h1><form action=\"index.php\" method=\"post\" name=\"register\" id=\"register\">"; ! echo '<p>To register as a STACK user, please provide the following information.<p>'; ! echo '<table><tr><td>Username </td><td><input type="text" name="user[username]" size="25" value="'.stack_s($username).'" alt="User name" /></td><td>'.$err.'</td></tr>'; ! // TO DO: Need to fix typo in this form - institution ! stack_user_edit_form($user,$errors); ! echo '</table><input type="hidden" name="action" value="register" /><input type="submit" value="Register" /></form>'; ! break; case 'choose_quiz': *************** *** 132,136 **** break; case 'update_db': ! include("{$stack_root}/scripts/install/stackUpdateDatabase.php"); break; } --- 152,156 ---- break; case 'update_db': ! include("{$stack_root}/scripts/install/stackUpdateDatabase.php"); break; } Index: chat_mathml.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/chat_mathml.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** chat_mathml.php 29 Aug 2005 15:35:22 -0000 1.8 --- chat_mathml.php 29 Aug 2005 18:41:03 -0000 1.9 *************** *** 14,18 **** session_start(); require_once('stackConfig.php'); ! // Deal with slahes in input --- 14,18 ---- session_start(); require_once('stackConfig.php'); ! require_once('stackLib.php'); // Deal with slahes in input Index: stackLib.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/stackLib.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** stackLib.php 29 Aug 2005 15:35:22 -0000 1.1 --- stackLib.php 29 Aug 2005 18:41:03 -0000 1.2 *************** *** 13,16 **** --- 13,21 ---- $stack_ver['cvsmodule'] = 'stack-1-0'; + if (file_exists('stackConfig.php')) { + include('stackConfig.php'); + } + + // The forbidden commands are generated dynamically, and stored here if (file_exists($stack_logfiles.'CASkeywords.php')) { *************** *** 28,33 **** require_once("{$stack_root}/scripts/stackUser.php"); - require_once("{$stack_root}/frontend_general/frontend_util.php"); - require_once("{$stack_root}/scripts/stackCAS.php"); if ('unix' == $stack_os) { --- 33,36 ---- Index: documentation.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/documentation.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** documentation.php 29 Aug 2005 15:35:22 -0000 1.7 --- documentation.php 29 Aug 2005 18:41:03 -0000 1.8 *************** *** 34,37 **** --- 34,39 ---- session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); + $default_action = ''; include($stack_root.'/frontend_general/process_input.php'); Index: stackConfig.php.dist =================================================================== RCS file: /cvsroot/stack/stack-1-0/stackConfig.php.dist,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** stackConfig.php.dist 29 Aug 2005 16:33:54 -0000 1.2 --- stackConfig.php.dist 29 Aug 2005 18:41:03 -0000 1.3 *************** *** 134,142 **** $stack_web_services_provide = FALSE; - /*************************************************************/ - /* Load the libraries */ - /*************************************************************/ - - require_once('stackLib.php'); - ?> --- 134,136 ---- Index: user.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/user.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** user.php 29 Aug 2005 15:35:22 -0000 1.5 --- user.php 29 Aug 2005 18:41:03 -0000 1.6 *************** *** 25,30 **** session_start(); require_once('stackConfig.php'); $default_action = 'none'; - include_once($stack_root.'/frontend_general/front_end_display.php'); include($stack_root.'/frontend_general/process_input.php'); --- 25,31 ---- session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); + $default_action = 'none'; include($stack_root.'/frontend_general/process_input.php'); Index: analysis.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/analysis.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** analysis.php 29 Aug 2005 15:35:22 -0000 1.18 --- analysis.php 29 Aug 2005 18:41:03 -0000 1.19 *************** *** 30,39 **** */ session_start(); - - /** - * Include local settings. - * - */ require_once('stackConfig.php'); require_once("{$stack_root}/html/trypopupform.html"); --- 30,36 ---- */ session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); + require_once("{$stack_root}/html/trypopupform.html"); Index: question_bank.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/question_bank.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** question_bank.php 29 Aug 2005 15:35:22 -0000 1.11 --- question_bank.php 29 Aug 2005 18:41:03 -0000 1.12 *************** *** 32,44 **** session_start(); require_once('stackConfig.php'); $default_action = 'questionbank_screen'; include($stack_root.'/frontend_general/process_input.php'); include('html/trypopupform.html'); include('html/helpform.php'); include('html/javascripthead.html'); include('html/inputtool.html'); ! include_once($stack_root.'/frontend_general/question_bank_util.php'); ! include_once($stack_root.'/frontend_general/qb_display.php'); $question = ''; --- 32,47 ---- session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); + require_once($stack_root.'/scripts/stackFrontend.php'); $default_action = 'questionbank_screen'; include($stack_root.'/frontend_general/process_input.php'); + include('html/trypopupform.html'); include('html/helpform.php'); include('html/javascripthead.html'); include('html/inputtool.html'); ! //include_once($stack_root.'/frontend_general/question_bank_util.php'); ! //include_once($stack_root.'/frontend_general/qb_display.php'); $question = ''; *************** *** 121,125 **** // Get the question, question options and question instance if required if ($get_question) { ! $question = stack_get_question($source); if (!$new_question) { stack_question_validate($question,$errors); --- 124,128 ---- // Get the question, question options and question instance if required if ($get_question) { ! $question = stack_question_get($source); if (!$new_question) { stack_question_validate($question,$errors); *************** *** 131,135 **** // Work out the correct value for any filter to be applied to the question // bank. This is not needed by all actions, but it is harmless to set it. ! $question_bank_filter = stack_get_questionbank_filter(); if ('export_xml' == $action) { --- 134,138 ---- // Work out the correct value for any filter to be applied to the question // bank. This is not needed by all actions, but it is harmless to set it. ! $question_bank_filter = stack_questionbank_filter_get(); if ('export_xml' == $action) { *************** *** 282,286 **** switch ($action) { case 'questionbank_screen': ! stack_display_qb_main($admin, $question_bank_filter); break; case 'edit': --- 285,298 ---- switch ($action) { case 'questionbank_screen': ! include("{$stack_root}/html/qselectform.php"); ! ! if ($admin) { ! stack_db_listquestions('edit',$question_bank_filter); ! } else { ! stack_db_listquestions('try',$question_bank_filter); ! } ! ! echo "<p><a href=\"javascript:SelectQs('export_xml_list');\">Export selected as XML</a> "; ! echo "<p><a href=\"javascript:SelectQs('edit_metadata');\">Edit metadata</a> "; break; case 'edit': *************** *** 288,292 **** print_string('qp_notadmin','stack'); } ! stack_display_qb_edit($question, $errors); break; } --- 300,311 ---- print_string('qp_notadmin','stack'); } ! include_once("{$stack_root}/scripts/stackAuthor.php"); ! include("{$stack_root}/html/qselectform.php"); ! stack_question_edit_form($question,$errors); ! ! echo "<p><a href=\"javascript:HelpPopup('all','author_questionfields');\">Help with question fields.</a>\n ! <a href=\"javascript:HelpPopup('all','author_options');\">Help with options.</a>\n ! <a href=\"javascript:HelpPopup('all','author_answertest');\">Help with answer tests.</a>\n ! <a href=\"javascript:HelpPopup('all','author_potresp');\">Help with potential responses.</a></p>"; break; } Index: chat.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/chat.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** chat.php 29 Aug 2005 15:35:22 -0000 1.11 --- chat.php 29 Aug 2005 18:41:03 -0000 1.12 *************** *** 14,17 **** --- 14,19 ---- session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); + $default_action = ''; include($stack_root.'/frontend_general/process_input.php'); *************** *** 20,24 **** $options['Display']='LaTeX'; ! include('html/pagehead.php'); ?> --- 22,26 ---- $options['Display']='LaTeX'; ! include('html/pagehead.php'); ?> Index: editquiz.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/editquiz.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** editquiz.php 29 Aug 2005 15:35:22 -0000 1.16 --- editquiz.php 29 Aug 2005 18:41:03 -0000 1.17 *************** *** 34,44 **** session_start(); require_once('stackConfig.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"); /////////////////////////////////////////////////////////////// --- 34,48 ---- session_start(); require_once('stackConfig.php'); + require_once('stackLib.php'); + + require_once("{$stack_root}/scripts/stackAuthor.php"); + require_once("{$stack_root}/scripts/stackFrontend.php"); require_once("{$stack_root}/html/trypopupform.html"); require_once("{$stack_root}/html/helpform.php"); require_once("{$stack_root}/html/quizjava.html"); + //require_once("{$stack_root}/frontend_general/editquiz_display.php"); + //include_once('frontend_general/edit_quiz_util.php'); /////////////////////////////////////////////////////////////// *************** *** 48,52 **** include('frontend_general/process_input.php'); - include_once('frontend_general/edit_quiz_util.php'); $PostTo = 'editquiz.php'; $filter = ''; --- 52,55 ---- *************** *** 65,69 **** // Work out the correct value for any filter to be applied to the question // bank. This is not needed by all actions, but it is harmless to set it. ! $question_bank_filter = stack_get_questionbank_filter(); //////////////////////////////////////////////// --- 68,72 ---- // Work out the correct value for any filter to be applied to the question // bank. This is not needed by all actions, but it is harmless to set it. ! $question_bank_filter = stack_questionbank_filter_get(); //////////////////////////////////////////////// *************** *** 101,106 **** if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! $quiz_source = 'post'; ! $quiz = stack_get_quiz('post', $quizid); if ('' == $quiz) { $quizid_source = 'post'; --- 104,108 ---- if ('quiz_edit' == $action or 'quiz_edit_addqs' == $action) { ! $quiz = nsf($_POST, 'quiz'); if ('' == $quiz) { $quizid_source = 'post'; *************** *** 108,115 **** } ! $quizid = stack_get_quizid($quizid_source, $quiz); if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { ! $quiz = stack_get_quiz('database', $quizid); } --- 110,126 ---- } ! // Establish the $quizid ! $quizid = ''; ! if ('quiz' == $quizid_source) { ! $quizid = nsf($quiz,'quizid'); ! } else if ('database' == $quizid_source) { ! $quizid = stack_db_quiz_update(array()); ! } else if ('post' == $quizid_source) { ! $quizid = nsf($_POST, 'quizid'); ! } ! if (('quiz_edit' == $action or 'quiz_edit_addqs' == $action) and '' == $quiz) { ! $quiz = stack_db_quiz_get($quizid); } *************** *** 165,169 **** include_once("{$stack_root}/scripts/stackXML.php"); ! $quiz = stack_get_quiz('database', $quizid); stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); --- 176,180 ---- include_once("{$stack_root}/scripts/stackXML.php"); ! $quiz = stack_db_quiz_get($quizid); stack_xml_remove_quiz_meta_defaults($quiz); //Pass quiz by reference and remove all default metadata $name = stack_xml_write_quiz_new($quiz,"{$stack_root}/tmp/"); *************** *** 174,179 **** //////////////////////////////////////////////// - stack_display_editquiz_error($errors); switch ($action) { case 'quiz_xml': --- 185,202 ---- //////////////////////////////////////////////// + // (3.1) Display any errors. + if (is_array($errors)) { + echo "<font color=\"red\">Errors exist!</font><br/>"; + if (array_key_exists('quiz',$errors)) { + foreach($errors['quiz'] as $key => $val) { + echo "The field $key, gave the following error."; + echo $val; + } + } + + } + + // (3.2) Now take some action switch ($action) { case 'quiz_xml': *************** *** 183,187 **** case 'quiz_choose': $quiz_store = stack_db_quiz_get(); ! stack_display_editquiz_select($quiz_store, $PostTo); break; case 'import': --- 206,210 ---- case 'quiz_choose': $quiz_store = stack_db_quiz_get(); ! stack_quiz_selectform($quiz_store, $PostTo); break; case 'import': *************** *** 189,193 **** } case 'quiz_report': ! $quizid = stack_get_quizid('post', $quiz); stack_quiz_report($quizid); break; --- 212,216 ---- } case 'quiz_report': ! $quizid = nsf($_POST, 'quizid'); stack_quiz_report($quizid); break; |