Subversion Repositories wimsdev

Rev

Rev 17315 | 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
codevar=!line 1 of $data
!default up_defconnip=!line 2 of $data
po=!positionof item $codevar in $tv_listcode
namevar=!item $po of $tv_listname

!bound up_codevar within $tv_listlocalcode default $codevar

listvar=bday,bmonth,byear,bhour,bmin,ehour,emin,nstud,testoextra,exconnip
!if $po isitemof $tv_listlocal and $codevar=$up_codevar
  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
    up=!replace internal : by , in $(up_etime$i)
    !distribute item $up into up_ehour$i,up_emin$i
    up=!replace internal : by , in $(up_btime$i)
    !distribute item $up into up_bhour$i,up_bmin$i
    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
    !if $(up_bdate$i)!=$empty
      up_byear$i=!char 1 to 4 of $(up_bdate$i)
      up_bmonth$i=!char 6 to 7 of $(up_bdate$i)
      up_bday$i=!char 9 to 10 of $(up_bdate$i)
    !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_codevar within $tv_listlocalcode default $codevar
  !if $up_codevar=$empty and $codevar=$empty
    error=bad_variable
    gstep=1
    !exit
  !endif
  !default codevar=$up_codevar
  !if $codevar=$empty
    error=no_variable
    gstep=1
    !exit
  !endif
  !writefile $votedir/$vote.data :$codevar\
$defconnip\
$data\
:$testointro
!endif

!if $gstep>=2
  !! get list of value for the technical variable :
  numvar=!positionof item $codevar in $tv_listcode
  tmp=!line $numvar of $tv_listtechvar
  namevar=!item $numvar of $tv_listname
  !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=$codevar\
$defconnip

  techvartable=\$codevar\
  !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 -p $wims_home/log/classes/$wims_class/techvar
  !writefile wimshome/log/classes/$wims_class/techvar/$codevar $techvartable
!endif