Subversion Repositories wimsdev

Rev

Rev 3587 | Rev 3921 | 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.
!read adm/class/classlang names.phtml

max_exo=64
title_limit=50
desc_limit=255
sheettot=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets
wims_helper=chapter=3
wims_prefix=none

!if $scoring=yes
 !default require=10
 !default weight=1
!else
 require=0
 weight=0
!endif

sup=$wims_user
class=$wims_class
!if $sup!=supervisor
 error=not_supervisor
 !exit
!endif

!if $cmd=new or $cmd=resume
 sheets=
 !for i=1 to $sheettot
  sh=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
  !distribute lines $sh into a_,t_,title
  !if $a_<1
   sheets=!append line $i,$title to $sheets
  !endif
 !next i
 sheetcnt=!linecnt $sheets
 !ifval $sheetcnt=0
  error=no_sheet
  !exit
 !endif
 title=!module title $dir
 desc=!module description $dir
 !exit
!endif

!if $cmd=reply
 !if ../adm/ isin ../$dir or $dir=home or \
   (../devel/ isin ../$dir and $wims_devel_modules notwordof open)
  error=insert_fail
  !exit
 !endif
 !if $picksheet=$empty
  error=no_pick
  !exit
 !endif
 picksheet=$[floor($picksheet)]
 !if $picksheet=NaN or $picksheet<1 or $picksheet>min(64,$sheettot)
  error=bad_sheet
  !exit
 !endif
 sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
 a=!line 1 of $sh
 !if $a>0
  error=bad_sheet
  !exit
 !endif
 exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
 !if $exocnt>=$max_exo
  error=too_many_exos
  !exit
 !endif
 idesc=!singlespace $new_desc
 idesc=!char 1 to $desc_limit of $idesc
 ititle=!singlespace $title
 ititle=!char 1 to $title_limit of $ititle
 !if $scoring=yes
  require=$[$require]
  weight=$[$weight]
  !if NaN isin $require
   require=0
  !endif
  !if NaN isin $weight
   weight=0
  !endif
  !bound require between 0,1000 default 0
  !bound weight between 0,10 default 0
 !endif
 !for i=1 to $exocnt
  e=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
  !distribute lines $e into wdi,win
  !if $dir=$wdi and $iniparm=$win
   test=$picksheet
   error=already_exist
   !exit
  !endif
 !next i
 !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$picksheet :$dir\
$iniparm\
$require\
$weight\
$ititle\
$idesc

 exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
 wims_module_log=class $class: add No$exocnt to sheet $picksheet
!endif