Rev 4338 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
!! process file to show result of vote
!if $vote_status=$empty or ($wims_user!=supervisor and $vote_status notwordof 1 2 )
error=bad_vote
job=home
!changeto home.proc
!endif
!if anonymous!=$vote_option
listjob2=global,list,listbystudent
!if supervisor=$wims_user
listjob2=$listjob2,studentbyitem
!endif
!else
job2=global
!endif
!bound job2 within $listjob2 default global
wims_multiexec=pari maxima yacas
insmath_rawmath=yes
wims_backslash_insmath=yes
parmcnt=0
!reset uvname, uvval, uvcnt
!readdef $userfile
!readdef $votedir/$vote.votes
!default vcnt=0
!if $wims_user!=supervisor and $(user_vote_$Vote)=$empty
error=no_vote
job=read
!changeto read.proc
!endif
!if $wims_user!=supervisor and $vote_show=0
job=home
!changeto home.proc
!endif
!if $vote>0
!if $choices1!=$empty
noprint=yes
!endif
vote_description=$empty
!read $votedir/$vote.def
!endif
max_rep=0
!for k=1 to $parmcnt
t=!itemcnt $(vote_description[$k;])
max_rep=$[max($max_rep,$t-2)]
!next k
!if $vote_option=anonymous
!exit
!endif
!if $vote_option=trace
listkey=!values v for v=1 to $vcnt
namelist=!makelist <th>$name_votants v</th> for v=1 to $vcnt
!else
listkey=$empty
namelist=$empty
!endif
!for k=1 to $parmcnt
!if textarea!=$(vote_description[$k;2])
donvote_$k=!makelist -- for v=1 to $vcnt
nbch=!itemcnt $(vote_description[$k;])
!for l=3 to $nbch
!for m in $(votes_$(k)_$[$(l)-2])
!if $m notitemof $listkey
listkey=!append item $m to $listkey
!if $vote_option=nominative
tmp=!replace internal / by , in $m
tmp=!defof user_firstname\
user_lastname in wimshome/log/classes/$wims_superclass/.users/$(tmp[-1])
tmp=!lines2words $tmp
namelist=!append item <th>$tmp</th> to $namelist
!endif
!endif
mkey=!positionof item $m in $listkey
newval=!item $mkey of $(donvote_$k)
!if $newval!=--
newval=$newval ; $(vote_description[$k;$l])
!else
newval=$(vote_description[$k;$l])
!endif
donvote_$k=!replace item number $mkey by $newval in $(donvote_$k)
!next m
!next l
!endif
!next k