Subversion Repositories wimsdev

Rev

Rev 13082 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8817 guerimand 1
!if $step=$empty
2
    step=1
3
!endif
4
 
5
max_exos=!defof MAX_EXOS in wimshome/public_html/bases/sys/define.conf
6
max_sheets=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
7
title_limit=50
8
desc_limit=255
9
 
10
!if $scoring=yes
12315 bpr 11
  !default require=10
12
  !default weight=1
8817 guerimand 13
!else
12315 bpr 14
  require=0
15
  weight=0
8817 guerimand 16
!endif
17
 
18
!if $step=1
12315 bpr 19
  sheets=
20
  !for i=1 to $sheettot
21
    sh=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
22
    !distribute lines $sh into a_,t_,title
23
    !if $a_<1
24
      sheets=!append line $i,$title to $sheets
25
    !endif
26
  !next i
27
  sheetcnt=!linecnt $sheets
28
  !ifval $sheetcnt=0
29
    error=no_sheet
30
    !exit
8817 guerimand 31
  !endif
12315 bpr 32
  special_parm2=expert
33
  smodule=$dir
34
  !distribute line $wims_oefdefault_qnum\
8817 guerimand 35
$wims_oefdefault_qcmlevel\
36
$wims_oefdefault_scoredelay\
37
$wims_oefdefault_qcmpresent\
13082 bpr 38
$wims_oefdefault_sol\
9108 bpr 39
$wims_oefdefault_check\
13082 bpr 40
$wims_oefdefault_expow\
41
$wims_oefdefault_sepow\
42
$wims_oefdefault_precw\
43
$wims_oefdefault_feed\
44
$wims_oefdefault_good\
45
$wims_oefdefault_hint\
46
  into qnum,qcmlevel,scoredelay,intro_qcmpresent,intro_sol,intro_check,\
47
  intro_expow,intro_sepow,intro_precw,intro_feed,intro_good,intro_hint
8817 guerimand 48
!endif
49
 
9436 bpr 50
!! calcul du nombre d'exercices
9174 guerimand 51
!if /////classes/ isin /////$smodule
52
    !! adresse du module d'exo d'une classe
12315 bpr 53
  dir_header=wimshome/log/classes/$wims_class
9174 guerimand 54
!else
55
    !! adresse d'un module public ou modtool
12315 bpr 56
  dir_header=wimshome/public_html/modules/$smodule
9174 guerimand 57
!endif
58
exolist=!defof exolist in $dir_header/Exindex
8817 guerimand 59
exolist=!char 17 to -2 of $exolist
9174 guerimand 60
exotitle=!defof titlelist in $dir_header/Exindex
8817 guerimand 61
exotitle=!char 17 to -2 of $exotitle
62
exocnt=!itemcnt $exolist
63
 
64
!if $step=2
9106 bpr 65
!! vérification des données de feuille.
12315 bpr 66
  !if $picksheet=$empty
67
    error=no_pick
68
    !exit
8817 guerimand 69
  !endif
12315 bpr 70
  picksheet=$[floor($picksheet)]
71
  !if $picksheet=NaN or $picksheet<1 or $picksheet>min($max_sheets,$sheettot)
72
    error=bad_sheet
73
    !exit
8817 guerimand 74
  !endif
12315 bpr 75
  sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
76
  a=!line 1 of $sh
77
  !if $a>0
78
    error=bad_sheet
79
    !exit
80
  !endif
81
  shexocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
82
  !if $exocnt+$shexocnt>$max_exos
83
    error=too_many_exos
84
    !exit
85
  !endif
86
  !if $scoring=yes
87
    require=$[$require]
88
    weight=$[$weight]
89
    !if NaN isin $require
90
      require=0
91
    !endif
92
    !if NaN isin $weight
93
      weight=0
94
    !endif
95
    !bound require between 0 and $[10*$require_limit] default 0
96
    !bound weight between 0 and 10 default 0
97
  !endif
9108 bpr 98
!! vérification des donnees d'execution du module d'exo
12315 bpr 99
  test_transl=!module translation_language $dir
100
  !if $lang iswordof $test_transl
101
    tr_lang=yes
102
    title=!module title_$lang $dir
103
    desc=!module description_$lang $dir
104
  !endif
105
  !default title=!module title $dir
106
  !default desc=!module description $dir
107
  desc_module=$desc
108
  cat=!module category $dir
109
  !if exercise notin $cat and oef notin $cat
110
    error=not_exo
111
    !exit
112
  !endif
113
  !bound qnum between integer 1 and 9 default $wims_oefdefault_qnum
114
  !bound qcmlevel between integer 1 and 9 default $wims_oefdefault_qcmlevel
115
  !bound intro_qcmpresent between integer 2 and 8 default $wims_oefdefault_qcmpresent
116
  !bound intro_presentsol between integer 0 and 2 default $wims_oefdefault_presentsol
117
  !bound intro_expow between 1 and 6 default $wims_oefdefault_expow
118
  !bound intro_sepow between 1 and 6 default $wims_oefdefault_sepow
119
  !bound intro_precw between 0 and 1 default $wims_oefdefault_precw
9108 bpr 120
 
13082 bpr 121
  intro_check=!listintersect $intro_check and 1,2
12315 bpr 122
  !bound random within 0,1 default 0
123
  !if $scoredelay!=$empty and $scoredelay!=0
124
    d_=!items2words $scoredelay
125
    !distribute words $d_ into delay1,delay2
126
    !bound delay1 between integer 0 and 2000 default 0
127
    !bound delay2 between integer $delay1 and 2000
128
    scoredelay=$delay1,$delay2
9108 bpr 129
  !endif
13082 bpr 130
 
12315 bpr 131
  iniparm=$empty
132
  !if $expert_=yes
133
    !if $intro_check!=$empty
14334 bpr 134
      !for k in $intro_check
135
        iniparm=$(iniparm)&intro_check=$k
12315 bpr 136
      !next k
137
    !endif
13082 bpr 138
    !for c in expow,sepow,precw,sol,hint,good,feed,qcmpresent
139
      iniparm=$(iniparm)&intro_$c=$(intro_$c)
140
    !next
12315 bpr 141
  !endif
13082 bpr 142
  iniparm=qnum=$qnum&qcmlevel=$qcmlevel&scoredelay=$scoredelay&seedrepeat=$seedrepeat$iniparm
143
 
12489 bpr 144
  !! ------  write data in the sheet file.
145
  !! analyse series already in the sheet
12315 bpr 146
  listmod=$empty
147
  listiniparm=$empty
148
  !for i=1 to $shexocnt
149
    e=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
150
    !distribute lines $e into wdi,win
14334 bpr 151
    listmod=!append line $wdi to $listmod
12315 bpr 152
    listiniparm=!append line $win to $listiniparm
153
  !next i
154
  !! Ecriture
155
  writedon=$empty
156
  listalready=$empty
157
  !for j=1 to $exocnt
158
    ex=!item $j of $exolist
159
    lerror=0
160
    exoiniparm=exo=$ex&$iniparm
161
    !for i=1 to $shexocnt
14334 bpr 162
      wdi=!line $i of $listmod
163
      win=!line $i of $listiniparm
164
      !if $smodule=$wdi and $exoiniparm=$win
165
        lerror=1
166
      !endif
167
    !next i
12315 bpr 168
    !if $lerror=1
14334 bpr 169
      listalready=!append item $ex to $listalready
12315 bpr 170
    !else
171
      !reset desc
172
      desc_=!lookup $ex in wimshome/public_html/modules/$smodule/Descindex
173
      !if $desc_!=$empty
174
        desc=$desc_
175
      !endif
176
      !default desc=$desc_module
177
      obs_=!lookup $ex in wimshome/public_html/modules/$smodule/Obsindex
14334 bpr 178
      writedon=!append line :$smodule\
8817 guerimand 179
$exoiniparm\
180
$require\
181
$weight\
182
$(exotitle[$j])\
183
$desc\
9436 bpr 184
\
185
$obs_\
8817 guerimand 186
 to $writedon
12315 bpr 187
    !endif
188
  !next j
189
  !if $writedon!=$empty
190
    !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$picksheet $writedon
191
  !endif
192
  last=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
193
  notadd=!itemcnt $listalready
194
  addexo=$[$exocnt-$notadd]
195
  wims_module_log=class $class: add  No$[$last-$addexo+1] to No$last to worksheet $picksheet
196
  sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
197
  title=!line 3 of $sh
8817 guerimand 198
!endif