Rev 16928 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
!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 mémoire, pour l'instant rien n'est changé.
!! essai de réparation 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