Subversion Repositories wimsdev

Rev

Rev 2240 | Rev 11784 | Go to most recent revision | 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

jmonth=!char 2,3 of $[abs(floor($jmonth))+100]
jday=!char 2,3 of $[abs(floor($jday))+100]
jyear=!char -4 to -1 of $[abs(floor($jyear))+100000]
!if $jday>=1 and $jday<=31 and $jmonth>=1 and $jmonth<=12 \
        and N notin $jmonth$jday$jyear
!!      and $jyear$jmonth$jday<=$class_expiration
!!      and $jyear$jmonth$jday>=$class_creation 
 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
 dmonth=!char 2,3 of $[abs(floor($(dmonth$i)))+100]
 dday=!char 2,3 of $[abs(floor($(dday$i)))+100]
 dyear=!char -4 to -1 of $[abs(floor($(dyear$i)))+100000]
 !if $dday>=1 and $dday<=31 and $dmonth>=1 and $dmonth<=12 \
        and N notin $dmonth$dday$dyear \
        and $dyear$dmonth$dday>$jour
!!      and $dyear$dmonth$dday<=$class_expiration
!!      and $dyear$dmonth$dday>=$class_creation 
  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