Subversion Repositories wimsdev

Rev

Rev 14300 | Blame | Compare with Previous | Last modification | View Log | RSS feed

# Variable calculations should be done in this file.
# It is read and interpreted by wims for all valid calls to the module.

desc_limit=4000

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

!bound nbredevoir between integer 1 and $max_todo default 1
!if $s_nbdevoir!=$nbredevoir
  !reset job2
!endif
s_nbdevoir=$nbredevoir

!if $job2!=save
  !exit
!endif

jyear=!char 1 to 4 of $jdate
jmonth=!char 6 to 7 of $jdate
jday=!char 9 to 10 of $jdate
!if $jday>=1 and $jday<=31 and $jmonth>=1 and $jmonth<=12 and N notin $jmonth$jday$jyear
  jour=$jyear$jmonth$jday
!else
  error=bad_day
  !exit
!endif
!reset date_todo,date_exist
!read wimshome/log/classes/$wims_class/cdt/def/$jour
tmp=!itemcnt $date_todo
!if yes isin $date_exist and $tmp+$s_nbdevoir>$max_todo
  error=toomany_todo
  !if $tmp<$max_todo
    s_nbdevoir=$[$max_todo-$tmp]
    nbredevoir=$s_nbdevoir
  !endif
  !exit
!endif

ltjdevoir=$date_todo
!for i=1 to $s_nbdevoir
  dyear=!char 1 to 4 of $(ddate$i)
  dmonth=!char 6 to 7 of $(ddate$i)
  dday=!char 9 to 10 of $(ddate$i)
  !if $dday>=1 and $dday<=31 and $dmonth>=1 and $dmonth<=12 \
   and N notin $dmonth$dday$dyear \
   and $dyear$dmonth$dday>$jour
    jdevoir$i=$dyear$dmonth$dday
    ltjdevoir=!append item $(jdevoir$i) to $ltjdevoir
  !else
    error=bad_jday
    !exit
  !endif
!next i
tmp=!listuniq $ltjdevoir
tmp1=!itemcnt $tmp
tmp2=!itemcnt $ltjdevoir
!if $tmp1!=$tmp2
  error=same_devoir2
  !exit
!endif

s2file=$wims_home/s2/$wims_session/$jour

!if yes isin $date_exist
  !sh cp $wims_home/log/classes/$wims_class/cdt/def/$jour $s2file
!else
  cdt_nbdate=$[$cdt_nbdate+1]
  !writefile wimshome/log/classes/$wims_class/cdt/src/$jour.work $empty
  !writefile wimshome/s2/$wims_session/$jour !set date_exist=yes\
!set date_todo=$empty\
\
!if $$wims_read_parm!=$$empty\
 !goto $$wims_read_parm\
!endif\
!exit\
\
:content\
!exit

!endif

ltjdevoir=$date_todo
nb=!itemcnt $date_todo
!for i=1 to $s_nbdevoir
  !if $(ddesc$i)!=$empty
    nb=$[$nb+1]
    !writefile wimshome/log/classes/$wims_class/cdt/src/$jour.todo$nb $(ddesc$i)
    !sh $wims_home/bin/msg2wims $wims_home/log/classes/$wims_class/cdt/src/$jour.todo$nb $s2file.tmp;\
echo ":todo$nb" >> $s2file;\
cat $s2file.tmp >> $s2file;\
echo "!exit" >> $s2file;
    ltjdevoir=!append item $(jdevoir$i) to $ltjdevoir
  !endif
!next i

!setdef !set date_todo=$ltjdevoir in wimshome/s2/$wims_session/$jour
!sh rm $s2file.tmp;\
mv $s2file $wims_home/log/classes/$wims_class/cdt/def/$jour;

!read proc/mkindex.proc

!!jday2=$jday
!!jmonth2=$jmonth
!!jyear2=$jyear
job=work
!read work.proc