Subversion Repositories wimsdev

Rev

Rev 10721 | Rev 11849 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5235 czzmrn 1
 
2
today=!char 1 to 8 of $wims_now
3
thisyear=!char 1 to 4 of $today
7198 bpr 4
!if $class_expiration=$empty
5235 czzmrn 5
 !defread wimshome/log/classes/$wims_class/.def
6
!endif
7
!if $class_expiration=$empty
8
 error=bad_class
9
 !exit
10
!endif
11
 
10273 guerimand 12
data=!record 1 of $votedir/$vote.data
10736 guerimand 13
codevar=!line 1 of $data
10273 guerimand 14
!default up_defconnip=!line 2 of $data
10736 guerimand 15
po=!positionof item $codevar in $tv_listcode
16
namevar=!item $po of $tv_listname
10471 guerimand 17
 
10736 guerimand 18
!bound up_codevar within $tv_listlocalcode default $codevar
10273 guerimand 19
 
20
listvar=bday,bmonth,byear,bhour,bmin,ehour,emin,nstud,testoextra,exconnip
10736 guerimand 21
!if $po isitemof $tv_listlocal and $codevar=$up_codevar
10273 guerimand 22
 data=!line 3 to -1 of $data
23
 listcle=!column 1 of $data
24
 tmp=!line $po of $tv_listtechvar
25
 tmp=!record $(tmp[3]) of wimshome/log/classes/$wims_class/.techvar
26
 listval=!line 2 of $tmp
27
 numsess=!itemcnt $listval
28
 !default mod_numsess=$numsess
29
 !for i=1 to $numsess
30
   p=!positionof item $(listval[$i]) in $listcle
31
   !if $p!=$empty
32
    tdon=!line $p of $data
33
    !for v=1 to 10
34
     !default up_$(listvar[$v])$i=$(tdon[$v+1])
35
    !next v
36
   !endif
37
   !for var in $listvar
38
    $(var)$i=$(up_$(var)$i)
10241 guerimand 39
   !next var
40
 !next i
10273 guerimand 41
!else
42
 data=$empty
43
!endif
44
!default up_testointro=!record 2 of $votedir/$vote.data
45
testointro=$up_testointro
10471 guerimand 46
!for var in testointro,defconnip,namevar
5369 bpr 47
    !default up_$var=$($var)
48
    !set $var=$(up_$var)
10233 guerimand 49
!next var
5297 czzmrn 50
 
5369 bpr 51
!if $gstep=2
7198 bpr 52
!! need to check carefully namexevar vs. up_namevar (at some step we seem to
5369 bpr 53
!! be loosing the correction)(?? should this go outside the if $gstep=2)
10736 guerimand 54
 !bound up_codevar within $tv_listlocalcode default $codevar
55
 !if $up_codevar=$empty and $codevar=$empty
5369 bpr 56
   error=bad_variable
10241 guerimand 57
   gstep=1
58
   !exit
5369 bpr 59
 !endif
10736 guerimand 60
 !default codevar=$up_codevar
61
 !if $codevar=$empty
5369 bpr 62
  error=no_variable
10241 guerimand 63
  gstep=1
64
  !exit
5369 bpr 65
 !endif
10736 guerimand 66
 !writefile $votedir/$vote.data :$codevar\
10273 guerimand 67
$defconnip\
68
$data\
69
:$testointro
10241 guerimand 70
!endif
71
 
72
!if $gstep>=2
73
!! get list of value for the technical variable :
10736 guerimand 74
 numvar=!positionof item $codevar in $tv_listcode
10702 guerimand 75
 tmp=!line $numvar of $tv_listtechvar
10736 guerimand 76
 namevar=!item $numvar of $tv_listname
10241 guerimand 77
 !distribute item $tmp into bb,classid,num
78
 don=!record $num of wimshome/log/classes/$wims_class/.techvar
79
 listval=!line 2 of $don
80
 numsess=!itemcnt $listval
81
!endif
82
 
83
!if $gstep=3
84
!!## need to check $testointro contains no vote primitives
10273 guerimand 85
 !for i in uservar,menu,list,radio,checkbox,textarea
86
   testointro=!replace internal \$i by INVALID in $testointro
87
 !next i
10736 guerimand 88
 donfile=$codevar\
10273 guerimand 89
$defconnip
10241 guerimand 90
 
10736 guerimand 91
 techvartable=\$codevar\
10305 guerimand 92
!set techvar_EMPTY=>$class_expiration
10273 guerimand 93
 !for i=1 to $numsess
94
  !!## need to check no "," in exconnip/testoextra and numerical for date variable.
95
  exconnip$i=!replace internal , by . in $(exconnip$i)
96
  testoextra$i=!replace internal , by . in $(testoextra$i)
10535 czzmrn 97
  nstud$i=$[max(-1,$(nstud$i))]
98
  !if NaN isin $(nstud$i) or . isin $(nstud$i)
99
    nstud$i=-1
100
  !endif
10273 guerimand 101
  !for v in bday,bmonth,byear,bhour,bmin,ehour,emin
102
   !if NaN isin $[$($v$i)*1]
103
	$v$i=$empty
104
   !endif
105
  !next v
10241 guerimand 106
 
10273 guerimand 107
  ligne=$(listval[$i])
108
  !for var in $listvar
109
   ligne=!append item $($var$i) to $ligne
110
  !next var
111
  donfile=!append line $ligne to $donfile
112
 !next i
113
 !writefile $votedir/$vote.data :$donfile\
10241 guerimand 114
:$testointro
10273 guerimand 115
 
10241 guerimand 116
!set reg_src=<div>\
117
$testointro\
118
</div>\
119
\list{
120
 
121
 reg_src1=$reg_src
122
 reg_src2=\uservar{$namevar,$empty,
123
 !for i=1 to $numsess
124
  mese$i=!item $(bmonth$i) of $months
125
  bmonth$i=!char 2,3 of $[abs(floor($(bmonth$i)))+100]
126
  byear$i=!char -4 to -1 of $[abs(floor($(byear$i)))+100000]
127
  bmin$i=!char 2,3 of $[abs(floor($(bmin$i)))+100]
128
  emin$i=!char 2,3 of $[abs(floor($(emin$i)))+100]
129
  bday$i=!char 2,3 of $[abs(floor($(bday$i)))+100]
130
  bhour$i=!char 2,3 of $[abs(floor($(bhour$i)))+100]
131
  ehour$i=!char 2,3 of $[abs(floor($(ehour$i)))+100]
10536 czzmrn 132
!!
133
!! ??? (MC) for vote "0" means "no limit", but maybe when a teacher 
134
!! writes "0" here he/she means really "0" so we should change 
135
!! $(nstud$i) to "-1"?
136
!!
137
!! writing "0:" gives bad output in the vote page
138
!if $(nstud$i)=0
10241 guerimand 139
  reg_src1=$reg_src1\
10536 czzmrn 140
 $(bday$i) $(mese$i) $(byear$i) - $(bhour$i).$(bmin$i) / $(ehour$i).$(emin$i)$ $(testoextra$i),
141
!else
142
  reg_src1=$reg_src1\
10241 guerimand 143
$(nstud$i): $(bday$i) $(mese$i) $(byear$i) - $(bhour$i).$(bmin$i) / $(ehour$i).$(emin$i)$ $(testoextra$i),
10536 czzmrn 144
!endif
10241 guerimand 145
  techvartable=$techvartable\
10305 guerimand 146
!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)
10241 guerimand 147
  reg_src2=$reg_src2\
148
$(listval[$i]),
149
 !next i
150
 
151
 reg_src=$reg_src1\
152
$name_cancellation\
153
}\
154
$reg_src2\
155
$empty\
156
}
10736 guerimand 157
 !sh mkdir -p $wims_home/log/classes/$wims_class/techvar
158
 !writefile wimshome/log/classes/$wims_class/techvar/$codevar $techvartable
5369 bpr 159
!endif