Subversion Repositories wimsdev

Rev

Rev 10702 | Rev 10736 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed


today=!char 1 to 8 of $wims_now
thisyear=!char 1 to 4 of $today
!if $class_expiration=$empty
 !defread wimshome/log/classes/$wims_class/.def
!endif
!if $class_expiration=$empty
 error=bad_class
 !exit
!endif

data=!record 1 of $votedir/$vote.data
namevar=!line 1 of $data
!default up_defconnip=!line 2 of $data
po=!positionof item $namevar in $tv_listname

!bound up_namevar within $tv_listlocalname default $namevar

listvar=bday,bmonth,byear,bhour,bmin,ehour,emin,nstud,testoextra,exconnip
!if $po isitemof $tv_listlocal and $namevar=$up_namevar
 data=!line 3 to -1 of $data
 listcle=!column 1 of $data
 tmp=!line $po of $tv_listtechvar
 tmp=!record $(tmp[3]) of wimshome/log/classes/$wims_class/.techvar
 listval=!line 2 of $tmp
 numsess=!itemcnt $listval
 !default mod_numsess=$numsess
 !for i=1 to $numsess
   p=!positionof item $(listval[$i]) in $listcle
   !if $p!=$empty
    tdon=!line $p of $data
    !for v=1 to 10
     !default up_$(listvar[$v])$i=$(tdon[$v+1])
    !next v
   !endif
   !for var in $listvar
    $(var)$i=$(up_$(var)$i)
   !next var
 !next i
!else
 data=$empty
!endif
!default up_testointro=!record 2 of $votedir/$vote.data
testointro=$up_testointro
!for var in testointro,defconnip,namevar
    !default up_$var=$($var)
    !set $var=$(up_$var)
!next var

!if $gstep=2
!! need to check carefully namexevar vs. up_namevar (at some step we seem to
!! be loosing the correction)(?? should this go outside the if $gstep=2)
 !bound up_namevar within $tv_listlocalname default $namevar
 !if $up_namevar=$empty and $namevar=$empty
   error=bad_variable
   gstep=1
   !exit
 !endif
 !default namevar=$up_namevar
 !if $namevar=$empty
  error=no_variable
  gstep=1
  !exit
 !endif
 !writefile $votedir/$vote.data :$namevar\
$defconnip\
$data\
:$testointro
!endif

!if $gstep>=2
!! get list of value for the technical variable :
 numvar=!positionof item $namevar in $tv_listname
 tmp=!line $numvar of $tv_listtechvar
 varcode=!item $numvar of $tv_listcode
 !distribute item $tmp into bb,classid,num
 don=!record $num of wimshome/log/classes/$wims_class/.techvar
 listval=!line 2 of $don
 numsess=!itemcnt $listval
!endif

!if $gstep=3
!!## need to check $testointro contains no vote primitives
 !for i in uservar,menu,list,radio,checkbox,textarea
   testointro=!replace internal \$i by INVALID in $testointro
 !next i
 donfile=$namevar\
$defconnip

 techvartable=\$varcode\
!set techvar_EMPTY=>$class_expiration
 !for i=1 to $numsess
  !!## need to check no "," in exconnip/testoextra and numerical for date variable.
  exconnip$i=!replace internal , by . in $(exconnip$i)
  testoextra$i=!replace internal , by . in $(testoextra$i)
  nstud$i=$[max(-1,$(nstud$i))]
  !if NaN isin $(nstud$i) or . isin $(nstud$i)
    nstud$i=-1
  !endif
  !for v in bday,bmonth,byear,bhour,bmin,ehour,emin
   !if NaN isin $[$($v$i)*1]
        $v$i=$empty
   !endif
  !next v

  ligne=$(listval[$i])
  !for var in $listvar
   ligne=!append item $($var$i) to $ligne
  !next var
  donfile=!append line $ligne to $donfile
 !next i
 !writefile $votedir/$vote.data :$donfile\
:$testointro

!set reg_src=<div>\
$testointro\
</div>\
\list{

 reg_src1=$reg_src
 reg_src2=\uservar{$namevar,$empty,
 !for i=1 to $numsess
  mese$i=!item $(bmonth$i) of $months
  bmonth$i=!char 2,3 of $[abs(floor($(bmonth$i)))+100]
  byear$i=!char -4 to -1 of $[abs(floor($(byear$i)))+100000]
  bmin$i=!char 2,3 of $[abs(floor($(bmin$i)))+100]
  emin$i=!char 2,3 of $[abs(floor($(emin$i)))+100]
  bday$i=!char 2,3 of $[abs(floor($(bday$i)))+100]
  bhour$i=!char 2,3 of $[abs(floor($(bhour$i)))+100]
  ehour$i=!char 2,3 of $[abs(floor($(ehour$i)))+100]
!!
!! ??? (MC) for vote "0" means "no limit", but maybe when a teacher 
!! writes "0" here he/she means really "0" so we should change 
!! $(nstud$i) to "-1"?
!!
!! writing "0:" gives bad output in the vote page
!if $(nstud$i)=0
  reg_src1=$reg_src1\
 $(bday$i) $(mese$i) $(byear$i) - $(bhour$i).$(bmin$i) / $(ehour$i).$(emin$i)$ $(testoextra$i),
!else
  reg_src1=$reg_src1\
$(nstud$i): $(bday$i) $(mese$i) $(byear$i) - $(bhour$i).$(bmin$i) / $(ehour$i).$(emin$i)$ $(testoextra$i),
!endif
  techvartable=$techvartable\
!set techvar_$(listval[$i])=>$(byear$i)$(bmonth$i)$(bday$i).$(bhour$i):$(bmin$i) <$(byear$i)$(bmonth$i)$(bday$i).$(ehour$i):$(emin$i) $(exconnip$i)
  reg_src2=$reg_src2\
$(listval[$i]),
 !next i

 reg_src=$reg_src1\
$name_cancellation\
}\
$reg_src2\
$empty\
}
 !sh mkdir $wims_home/log/classes/$wims_class/techvar
 !writefile wimshome/log/classes/$wims_class/techvar/$varcode $techvartable
!endif