1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569
|
!nocache
!set limit_exoseries=!getdef limit_exoseries in oef/default
!set modu_lang=$lang
!!! FIXME variable jquery_defined is not accessible here
!if $wims_theme!=default
!set jquery_defined=yes
!endif
!read getparm $module_init_parm seed
!if $get_seed!=$empty
!setseed $get_seed
module_init_parm=!replace internal seed=$get_seed by in $module_init_parm
!reset get_seed
!endif
!!wseed=$seed
!!!if $wseed!=$empty and $wims_user=supervisor
!! !setseed $wseed
!!!endif
!!
!! variable presentgood has not been defined
!!
!read oef/testseedscore.phtml
!readproc oef/get_presentgood.proc
!!
oefenv_presentgood=$presentgood
!read oef/$lang/names.proc
!if $lang_exists!=yes
!let modu_lang=en
!read oef/$modu_lang/names.proc
!endif
!set module_language=$lang
translation_language=!module translation_language $module
oefenv_lang=$lang
!if $translation_language!=$empty and $lang_choice!=$empty
oefenv_lang=$lang_choice
!endif
!set name_choose_code=!defof name_choose_code in anstype/menu.input
!default module_help=popup
#if you change these limits, you have to modify var.def!
limit_var=2048
!!does not work because it is not an administrative modules but the limit are here
!!limit_choice=!getdef MAX_OEFCHOICES in wimshome/public_html/bases/sys/define.conf
!!limit_reply=!getdef MAX_OEFREPLIES in wimshome/public_html/bases/sys/define.conf
limit_reply=100
limit_choice=30
testnum=10
savedrawcnt=1
savetexcnt=1
proc=oef
!if $cmd=new and $allow_missing_data != yes
module_checkdata=!checkdata
!if $module_checkdata!=yes
wims_module_log=Missing datamodule $module_checkdata
!exit
!endif
!else
module_checkdata=yes
!endif
wims_noexport=$wims_noexport reply choice score oef hint fill val vsave \
deffile tmp thisexo ch_ exolist titlelist shufflelist \
name_ parm exo posvar sp_ slib_
wims_multiexec=pari maxima yacas octave gap
insmath_rawmath=yes
wims_backslash_insmath=yes
# Limit Pari precision, for otherwise many computations will fail.
proc_oef=yes
!default precision=10000
!default pari_precision=18
!default print_precision=8
!default maxima_precision=$print_precision
wims_print_precision=$print_precision
maxima_header=expon:0; expop:0; factlim:6; prederror: false;\
maxnegex:20; maxposex:20; ratfac:true; keepfloat:true;\
ordergreat(x,y,z,t)
pari_header=x;y;z;t;
executed_str=__EXECUTED_1692754_EXERCISE__
!for j_ in lastname,firstname,login,now
!default m_oef_$(j_)=$(wims_$(j_))
!default m_oef_$(j_)=$(name_$(j_))
!next
!default m_oef_lang=$lang
!default m_oef_login=anonymous
m_oefenv=!replace word debug by $ in $m_oefenv
!if ($wims_developer!=$empty and ../devel/$wims_developer isin ../$module \
and _test isin $wims_session) or \
../adm/createxo isin ../$module or \
($wims_user=supervisor and $wims_isexam<1 and _check notin $wims_session)
!default oef_default=no
m_oefenv=!singlespace $m_oefenv debug
!endif
!if $cmd=help
!if $special_parm=about
!read $(class_header)Exindex
exo=!listintersect $exo and $exolist
!endif
!default lang_choice=$lang
!set title=!defof title_$lang_choice in $deffile
!default title=!defof title in $deffile
!set module_title=$title
!set modtitle=$title
!set module_author=$author
!set module_address=$email
nn=!itemcnt $shufflelist
thisexo=!item ($reply_cnt)%$nn+1 of $shufflelist
!readproc oef/valback.proc
!readproc oef/imagedir.proc
val1=$imagedir
m_step=$oefstep
!exit
!endif
!if $cmd=new or $cmd=renew
starttime=$wims_nowseconds
!endif
!default insplot_set=size 0.6,0.6
!default idontknow=1
!default allchoices=0
!if $oef_test=yes
print=
qnum=1
qcmlevel=1
intro_qcmpresent=8
intro_sol=1
intro_feed=1
freepower=2
scorepower=1
random=0
exocnt=1
precweight=0.9
!if $retest=again
!reset status retest oef_default
!endif
!else
!read $(class_header)Exindex
!! FIXME
!! mis pour mmoire, pour l'instant rien n'est chang.
!! essai de rparation de la perte de special_parm3
!! on trafique ensuite module_init_parm et special_parm3
!! mais si special_parm3 existe on n'en fait rien !
exocnt=!itemcnt $exolist
!!!if $special_parm3!=$empty
!! !read getparm $special_parm3 qnum
!! qnum=$get_qnum
!!!else
!bound qnum between integer 1 and $limit_exoseries default 1
!bound qcmlevel between integer 1 and 9 default 3
!bound random within 0,1 default 1
tmp=!replace internal & by ; in $module_init_parm
!! URL encode \n
tmp=!replace internal $\
$ by %0A in $tmp
tmp=intro_check=$intro_check;random=$random;$tmp
tmp=!replace internal scoredelay=; by scoredelay=0; in $tmp
#tmp=!replace internal exo=; by exo=0; in $tmp
special_parm3=!nospace $tmp
!!!endif
!if $scoredelay!=$empty and $scoredelay!=0
d_=!items2words $scoredelay
!distribute words $d_ into delay1,delay2
!bound delay1 between integer 0 and 2000 default 0
!bound delay2 between integer $delay1 and 2000
!endif
!reset scoredelay tmp
!endif
!default format=html
!if $print!=$empty
!changeto oef/print.proc
!endif
!if $cmd=reply and $status!=waiting
error=double_reply
!exit
!endif
!if $status=$empty
!read oef/exo.init
!endif
!if $cmd iswordof new renew reply and \
($wims_user=supervisor or $wims_user=$empty or $wims_developer!=$empty)
exonext=!positionof item $exo in $exolist
exoprev=$[$exonext-1]
exonext=$[$exonext+1]
!if $exonext > $exocnt
exonext=1
!endif
!if $exoprev < 1
exoprev=$exocnt
!endif
exoprev=!item $exoprev of $exolist
exonext=!item $exonext of $exolist
!endif
!if $status!=waiting
!for i=1 to $limit_reply
!reset replygood$i
!next i
!reset solution, hint, help, oefsteps, oefstepcnt, latex
!for i=1 to 16
savedraw$i=
savetex$i=
!next i
!endif
!if $oef_test=yes
deffile=wimshome/$wims_sesdir/submit.def
!else
nn=!itemcnt $shufflelist
thisexo=!item ($reply_cnt)%$nn+1 of $shufflelist
deffile=$(class_header)def/$thisexo.def
!if $nn>1 and $status!=waiting
wims_module_log=$wims_module_log got $thisexo
!endif
!endif
!readproc oef/imagedir.proc
!distribute items 0,0,0,0,0,0 into \
varcnt,postvarcnt,replycnt,choicecnt,conditioncnt,feedbackcnt
!if $status!=waiting
!reset ansorder,oefstep,oefsteps,oefstepcnt,nextstep,dynsteps,\
cchoicecnt, creplycnt, embedcnt, vsavelist, leftrange, rightrange
!read $deffile
!read oef/var.prep
!else
!read $deffile
!if $savedraw1!=$empty
savedrawcnt=0
!for i=1 to 16
!if $(savedraw$i)!=$empty
!read oef/draw.phtml $(savedraw$i)
!else
!if $(savetex$i)!=$empty
!read oef/teximg.phtml $(savetex$i)
!endif
!endif
!next i
!endif
!readproc oef/valback.proc
!if $oefsteps!=$empty
!readproc oef/steps.proc
!endif
!endif
!if $embedcnt>0 or $embedcnt=$empty
hasembedding=yes
!endif
!if $oefsteps!=$empty
thisstep=!line $oefstep of $oefsteps
gotsteps=!line 1 to $oefstep of $oefsteps
gotsteps=!lines2items $gotsteps
m_step=$oefstep
!else
cchoicecnt=$choicecnt
creplycnt=$replycnt
!endif
!if $cmd=reply and $status=waiting
!if ($oefsteps!=$empty and $oefstep<$oefstepcnt) or \
($dynsteps=yes and $oefstep=$oefstepcnt)
!readproc oef/step.proc
!if $dynsteps=yes and $oefstep>$oefstepcnt
oefstep=$[$oefstep-1]
!goto ana
!endif
!if $stepdiag=ok or $error!=$empty
!goto end
!endif
!else
!if $oefsteps!=$empty and $oefstep=$oefstepcnt
!for i=1 to $replycnt
!if r$i isitemof $gotsteps and r$i notitemof $thisstep
reply$i=$(saverep$i)
!endif
!next i
!for i=1 to $choicecnt
!if c$i isitemof $gotsteps and c$i notitemof $thisstep
choice$i=$(savech$i)
!endif
!next i
!endif
!endif
:ana
!distribute item 0,0,0,0,0,0,0,0,0 into \
conditionned, freegot, condgot, qcmgot, \
precgood, weightadjust, gotadjust, cweightadjust, cgotadjust
!for i=1 to $replycnt
tt=!word 1 of $(replygood$i)
tmp_oefsteps=!lines2items $oefsteps
!if $tt=?analyze
!if r$i isitemof $tmp_oefsteps or $gotsteps=$empty
!advance conditionned
!endif
!else
!if $oefsteps!=$empty and r$i notitemof $gotsteps
!if r$i isitemof $tmp_oefsteps
tmp_ans_w=$[$(replyweight$i)]
!if $(replyweight$i)!=$empty and NaN notin $tmp_ans_w and Inf notin $tmp_ans_w and \
$tmp_ans_w!=1
weightadjust=$[$weightadjust+$tmp_ans_w-1]
!endif
!reset tmp_ans_w tmp_oefsteps
!endif
!goto cont
!endif
!endif
!if $(replygood$i)=$empty
!advance freegot
!goto cont
!endif
!if $(replytype$i)=coord and $(reply$i)=$empty
reply$i=$click_x,$click_y
reply$i=!nonempty item $(reply$i)
!if $(reply$i)!=$empty
reply$i=($(reply$i))
!endif
!endif
r_=!trim $(reply$i)
!if $(replytype$i)!=code
reply$i=$r_
!endif
default_$i=!getopt default in $(replyoption$i)
!if $(default_$i)!=$empty and ($r_=$empty or ($r_=$name_choose_code and $(replytype$i) iswordof menu))
reply$i=$(default_$i)
r_=$(default_$i)
!endif
!if $r_=$empty or \
($(reply$i)=$name_choose_code and $(replytype$i) iswordof menu)
!if $oefsteps=$empty or r$i isitemof $gotsteps
error=empty_data
!goto end
!else
reply$i=????
diareply$i=bad
!goto cont
!endif
!endif
!! add default to fix a bug with nextstep and type click
!default m_reply$i=$(reply$i)
!default m_reply_$i=$(reply_$i)
!default replytype$i=default
tt=!word 1 of $(replygood$i)
# analyzed reply
!if $tt=?analyze
g_=!rows2lines $(replygood$i)
g_=!line 1 of $g_
tt=!word 2 of $g_
!read oef/ans.proc $i nocompare
!if $error!=$empty
!goto end
!endif
!default m_reply$i=$(reply$i)
!default m_reply_$i=$(reply_$i)
!read oef/screply.proc
val$tt=$(m_reply$i)
!if NaN isin $test
!goto badans
!endif
!goto cont
!endif
!read oef/ans.proc $i
!if $error!=$empty
!goto end
!endif
!default m_reply$i=$(reply$i)
!default m_reply_$i=$(reply_$i)
!default m_reply_$i=$(reply$i)
!read oef/screply.proc
!if bad isin $Test
error=bad_exo $i
!advance reply_cnt
status=
!goto end
!endif
!if NaN isin $test
:badans
error=bad_answer
bad_name=$(replyname$i)
bad_value=$(reply$i)
!goto end
!endif
:cont
!reset test Test
!next i
!for i=1 to $choicecnt
!if $oefsteps!=$empty and c$i notitemof $gotsteps
!goto contc
!endif
!default choice$i=0
choic=$[rint($(choice$i))]
!if $choic=0 and ($oefsteps=$empty or c$i isitemof $gotsteps)
error=empty_data
!goto end
!endif
!if NaN isin $choic or $choic<1 or $choic>$(choiceitems$i)+2
error=bad_answer
bad_name=$(choicename$i)
bad_value=$(choice$i)
!goto end
!else
choice$i=$choic
!endif
ch=!item $choic of $(choicelist$i)
m_choice$i=$ch
!if $qcmgood<1 and $choic=$[$(choiceitems$i)+2]
!if $(choicegood$i)=$empty
chh=good
!else
chh=bad
!endif
!endif
!if ($choic<=$(choiceitems$i) and $ch isitemof $(choicegood$i)) or $chh=good
diachoice$i=good
m_sc_choice$i=1
!advance qcmgot
!else
diachoice$i=bad
m_sc_choice$i=0
!if $penalty>0 and $choic!=$[$(choiceitems$i)+1]
cc=!itemcnt $(choicegood$i)
!if $cc>=$(choiceitems$i)
cc=$[$(choiceitems$i)-1]
!endif
qcmgot=$[$qcmgot-$cc/($(choiceitems$i)-$cc)]
!endif
!if $choic=$[$(choiceitems$i)+1]
m_sc_choice$i=-1
!endif
!endif
:contc
!next i
!if $postvarcnt>0 and $thisstep_postdef!=done
!read $deffile postdef
!endif
!if $conditioncnt>0
testcondition=yes
condlist=all
!read $deffile test
testcondition=
!if $condlist issametext all
condlist=!values x for x=1 to $conditioncnt
!else
condlist=!words2items $condlist
!endif
conditioncnt=!itemcnt $condlist
!for i in $condlist
!default condweight$i=1
weightadjust=$[$weightadjust+$(condweight$i)-1]
!if $(condtest$i)>0
condgot=$[$condgot+$(condweight$i)]
!endif
!next i
!endif
!advance reply_cnt
freetot=$[$creplycnt+$conditioncnt-$conditionned+$weightadjust]
!if $freetot>0
freegot=$[$condgot+$freegot+$gotadjust+$precweight*$precgood]
!else
freegot=0
!endif
alltot=$[$freetot+$cchoicecnt]
allgot=$[$freegot+$qcmgot]
!if $alltot>0 and $allgot>0
allgot=$[($allgot/$alltot)^$freepower*$alltot]
!else
allgot=0
!endif
score_got=$[$score_got+$allgot]
score_should=$[$score_should+$alltot]
status=done
!if $reply_cnt>=$qnum
!bound score_got between 0 and $score_should
score=$[min(10,rint(100*($score_got/max(1,$score_should))^$scorepower)/10)]
module_score=$score
!if 0$delay2>0 and $starttime>0
n_=$wims_nowseconds
last=$[$n_-$starttime-4]
!if $last>0$delay1
toolate=$ $[$last-$delay1]-$[$last-$delay2]
!if $last>0$delay2 or $module_score<=0
module_score=0
!else
module_score=$[rint(10*$module_score*($delay2-$last)/($delay2-$delay1))/10]
!endif
!endif
!endif
!if $oef_test!=yes
wims_module_log=score $module_score/10$toolate
!endif
status=
!endif
!endif
:end
!if $cmd=hint or $cmd=resume
!! add to display student answer in case of use an hint or resume to work
!for i=1 to $replycnt
!default m_reply$i=$(reply$i)
!next i
!for i=1 to $choicecnt
m_choice$i=!item $(choice$i) of $(choicelist$i)
!next i
!endif
!if $status=waiting
!distribute item 1,1 into cntr,cntc
form_=document.forms['replyform']
!for t in $ansorder
!if $oefsteps=$empty or $t$(cnt$t) isitemof $thisstep
!if $t=r
!if $(replytype$(cnt$t)) notwordof checkbox
defaultest=!getopt default in $(replyoption$(cnt$t))
!if $defaultest=$empty
wims_form_lock=!append line if($form_.reply$(cnt$t).value.length==0) return emptyfield(); to $wims_form_lock
!else
!if nocheck notwordof $(replyoption$(cnt$t))
wims_form_lock=!append line if($form_.reply$(cnt$t).value.length==0) nb_default+=1; to $wims_form_lock
!endif
!endif
!else
!! test for checkboxes
wims_form_lock=!append line if(verify_checkboxes('reply$(cnt$t)')==null) return emptyfield(); to $wims_form_lock
!endif
!endif
!endif
!advance cnt$t
!next t
header_js=<script>\
function emptyfield() {\
alert("$name_empty"); return false;\
}\
function formcheck() {\
var nb_default=0;\
$wims_form_lock\
if(nb_default>0){\
if("jQuery" in window){jQuery("#exo_formCheck").foundation('open');return false;}\
{return window.confirm("$name_exo_form_check");}\
}\
return true;\
}\
function verify_checkboxes(box_name) {\
var checkedValue = null;\
var inputElements = document.getElementsByName(box_name);\
for(var i=0; inputElements[i]; ++i){\
if(inputElements[i].checked){\
checkedValue = inputElements[i].value;\
break;\
}\
}\
return checkedValue;\
}\
</script>
!endif
savedrawcnt=0
savetexcnt=0
|