Subversion Repositories wimsdev

Rev

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