Subversion Repositories wimsdev

Rev

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