Subversion Repositories wimsdev

Rev

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