Rev 16919 | Rev 17311 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
23 | reyssat | 1 | # Variable calculations should be done in this file. |
2 | # It is read and interpreted by wims for all valid calls to the module. |
||
2368 | bpr | 3 | !read adm/class/classlang names.phtml |
13046 | bpr | 4 | !! number of lines in a record of a sheet |
15763 | guerimand | 5 | !set sheetrecordlimit=11 |
13046 | bpr | 6 | |
10339 | bpr | 7 | !if $job!=$empty and $job notwordof text modify |
12701 | bpr | 8 | job1=$job |
9 | !!for the icon and the title |
||
10339 | bpr | 10 | !if $job=getsource |
11 | job1=sheetsource |
||
12 | !endif |
||
13 | !if $job=prep_putsource |
||
14 | job1=putsource |
||
15 | !endif |
||
10512 | bpr | 16 | !default name_$(job1)=$(wims_name_$job1) |
17 | wims_ariane=!append line sheetadmin,1,cmd=resume to $wims_ariane |
||
18 | !if $(name_$(job1))!=$empty or |
||
19 | wims_ariane=!append line "$(name_$(job1))",8, to $wims_ariane |
||
20 | !endif |
||
10339 | bpr | 21 | !else |
22 | !set wims_ariane=!append line sheetadmin,8 to $wims_ariane |
||
23 | !endif |
||
24 | !set wims_ariane_self=no |
||
25 | |||
9670 | guerimand | 26 | scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets |
27 | !if $sheet>$scnt |
||
12312 | bpr | 28 | wims_infoshow=yes |
29 | !setdef wims_infoshow=$wims_infoshow in wimshome/sessions/$wims_session/var.stat |
||
9670 | guerimand | 30 | !endif |
9655 | guerimand | 31 | !if $cmd=resume |
12312 | bpr | 32 | !bound infoshow within yes,no default $wims_infoshow |
33 | wims_infoshow=$infoshow |
||
34 | !setdef wims_infoshow=$wims_infoshow in wimshome/sessions/$wims_session/var.stat |
||
9655 | guerimand | 35 | !endif |
36 | |||
11965 | guerimand | 37 | tmp=!defof MAX_SHEETS\ |
11967 | guerimand | 38 | MAX_REQUIRE\ |
39 | DF_SEVERITY\ |
||
40 | MIN_WEIGHT\ |
||
16729 | guerimand | 41 | MAX_WEIGHT\ |
42 | MAX_EXOS in wimshome/public_html/bases/sys/define.conf |
||
43 | !distribute line $tmp into max_sheets,require_limit,df_severity,min_weight,max_weight,max_exos |
||
23 | reyssat | 44 | title_limit=80 |
45 | desc_limit=4000 |
||
46 | etitle_limit=100 |
||
47 | edesc_limit=400 |
||
12316 | bpr | 48 | |
8255 | bpr | 49 | require_limit=$[$require_limit/10] |
10305 | guerimand | 50 | wims_prefix=class user tmp n sharing sharable techvar |
23 | reyssat | 51 | srcname=wimshome/$wims_sesdir/home_sheet.src |
52 | wims_helper=chapter=3 |
||
53 | |||
1533 | guerimand | 54 | !readproc tabletheme |
23 | reyssat | 55 | !if $wims_user!=supervisor |
12312 | bpr | 56 | error=not_supervisor |
57 | !exit |
||
23 | reyssat | 58 | !endif |
1980 | guerimand | 59 | !if $job=chseries |
12312 | bpr | 60 | !changeto chseries.proc |
1980 | guerimand | 61 | !endif |
11633 | bpr | 62 | !readproc adm/levelname.phtml |
1980 | guerimand | 63 | !readproc adm/search_engine/names.$lang |
64 | !readproc adm/search_engine/mklist_form.proc |
||
23 | reyssat | 65 | |
66 | today=!char 1 to 8 of $wims_now |
||
67 | thisyear=!char 1 to 4 of $today |
||
68 | |||
7290 | bpr | 69 | !if $class_expiration=$empty |
12312 | bpr | 70 | !defread wimshome/log/classes/$wims_class/.def |
71 | !if $wims_superclass!=$empty |
||
72 | class_expiration=!defof class_expiration in wimshome/log/classes/$wims_superclass/.def |
||
73 | !endif |
||
23 | reyssat | 74 | !endif |
1533 | guerimand | 75 | |
23 | reyssat | 76 | !if $class_expiration=$empty |
12312 | bpr | 77 | error=bad_class |
78 | !exit |
||
23 | reyssat | 79 | !endif |
80 | |||
81 | sharers= |
||
82 | sharing1=!defof sharable_sheet in wimshome/log/classes/$wims_class/neighbors |
||
83 | !for c in $sharing1 |
||
12312 | bpr | 84 | d=!defof sharing_sheet in wimshome/log/classes/$c/neighbors |
85 | !if $d issametext $wims_class |
||
86 | sharers=!append item $c to $sharers |
||
87 | !endif |
||
23 | reyssat | 88 | !next c |
11967 | guerimand | 89 | |
12089 | guerimand | 90 | !if $save!=$empty |
12312 | bpr | 91 | jquery_defined=!defof jquery_defined in themes/$wims_theme/header.phtml |
92 | !if $jquery_defined=yes |
||
11800 | guerimand | 93 | expmon=!char 5 to 6 of $expdate |
94 | expday=!char 7 to 8 of $expdate |
||
95 | expyear=!char 1 to 4 of $expdate |
||
14366 | guerimand | 96 | !else |
97 | expmon=!char 2,3 of $[abs(floor($monthexpdate))+100] |
||
98 | expday=!char 2,3 of $[abs(floor($dayexpdate))+100] |
||
99 | expyear=!char -4 to -1 of $[abs(floor($yearexpdate))+100000] |
||
100 | expdate=$(expyear)$(expmonth)$(expday) |
||
12312 | bpr | 101 | !endif |
102 | !if $expday>=1 and $expday<=31 and $expmon>=1 and $expmon<=12 \ |
||
14335 | bpr | 103 | and $expyear>=$thisyear and $expyear<=$thisyear+1 \ |
104 | and $expyear$expmon$expday>$today \ |
||
105 | and $expyear$expmon$expday<=$class_expiration \ |
||
106 | and N notin $expmon$expday$expyear |
||
12312 | bpr | 107 | expiration=$expyear$expmon$expday |
108 | expdate=$expiration |
||
109 | !else |
||
110 | !if $expyear$expmon$expday>$class_expiration |
||
111 | !readproc adm/date.phtml $class_expiration |
||
112 | error=toolate |
||
113 | !else |
||
114 | expiration=$class_expiration |
||
115 | expdate=$expiration |
||
116 | !endif |
||
117 | !endif |
||
23 | reyssat | 118 | !endif |
12089 | guerimand | 119 | |
8255 | bpr | 120 | !if $sheet>$max_sheets |
12312 | bpr | 121 | error=bad_maxsheet |
122 | !exit |
||
3062 | bpr | 123 | !endif |
124 | |||
125 | !if $sheet<1 |
||
12312 | bpr | 126 | error=bad_sheet |
127 | !exit |
||
23 | reyssat | 128 | !endif |
129 | # menu preparation |
||
130 | !if $job!=$empty and $job iswordof \ |
||
14335 | bpr | 131 | prep_activate prep_erase prep_expire prep_putsource prep_modify |
12312 | bpr | 132 | data=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets |
15763 | guerimand | 133 | !distribute lines $data into active,expire,title,desc,bla,comment,attribut,exodescshow,formal_hidden_condition,indivtechvar |
12387 | bpr | 134 | !if $modif!=$empty |
135 | exo=!record $modif of wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
||
136 | !distribute lines $exo into D_,p_ |
||
137 | !read getparm $p_ exotrymax |
||
138 | !endif |
||
12312 | bpr | 139 | error=$job |
7801 | bpr | 140 | !if $expire < $today |
141 | test_expire=$expire,$today |
||
142 | !endif |
||
15859 | guerimand | 143 | !if $indivtechvar!=$empty and ($job=prep_modify or $job=prep_activate) |
15763 | guerimand | 144 | !readproc adm/vfilter/listvarfilter.proc |
145 | nb=!positionof item $indivtechvar in $tv_listcode |
||
146 | !if $nb!=$empty |
||
147 | don=!line $nb of $tv_listtechvar |
||
148 | !distribute item $don into name,classid,number |
||
149 | don=!record $number of wimshome/log/classes/$classid/.techvar |
||
150 | listval=!line 2 of $don |
||
15910 | guerimand | 151 | nbtechvalue=!itemcnt $listval |
15763 | guerimand | 152 | !else |
153 | !reset indivtechvar |
||
154 | !endif |
||
155 | !endif |
||
15859 | guerimand | 156 | !if $job=prep_activate |
16729 | guerimand | 157 | nb=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
158 | !if $nb>$max_exos |
||
159 | error=toomanyexo |
||
160 | !reset job |
||
161 | !exit |
||
162 | !endif |
||
15859 | guerimand | 163 | !read adm/sheet/checkdepindiv |
164 | !if $sheet isitemof $sheet_dependancy and $sheet isitemof $sheet_indivtechvar |
||
165 | error=depindiv |
||
166 | !reset job |
||
167 | !endif |
||
168 | !endif |
||
12312 | bpr | 169 | !exit |
23 | reyssat | 170 | !endif |
171 | scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets |
||
172 | !if $job=erase and $sheet<=$scnt and $sheet>=1 |
||
12312 | bpr | 173 | test= |
174 | !for s=$sheet to $scnt |
||
175 | l=!record $s of wimshome/log/classes/$wims_class/sheets/.sheets |
||
176 | l=!line 1 of $l |
||
177 | !if $l>0 |
||
178 | test=notclean |
||
179 | !endif |
||
180 | !next s |
||
181 | !if $test=$empty |
||
182 | update_field=0 |
||
183 | !read proc/update.docindex |
||
184 | !read update.sheet |
||
23 | reyssat | 185 | !endif |
16728 | guerimand | 186 | !read adm/sheet/writeweights |
12312 | bpr | 187 | !restart module=home |
23 | reyssat | 188 | !endif |
189 | |||
9679 | guerimand | 190 | !if $job=duplicate |
12312 | bpr | 191 | !changeto $job.proc |
9679 | guerimand | 192 | !endif |
193 | |||
23 | reyssat | 194 | !if $job=expire |
12312 | bpr | 195 | !distribute item 1,2 into update_field,update_content |
196 | !read update.sheet |
||
197 | job= |
||
23 | reyssat | 198 | !endif |
199 | |||
200 | !if $job=hide |
||
12312 | bpr | 201 | !distribute item 1,3 into update_field,update_content |
202 | !read update.sheet |
||
203 | job= |
||
23 | reyssat | 204 | !endif |
205 | |||
8093 | bpr | 206 | !if $job=reactivate |
12312 | bpr | 207 | !distribute item 1,1 into update_field,update_content |
208 | !read update.sheet |
||
209 | job= |
||
23 | reyssat | 210 | !endif |
211 | |||
212 | !if $job=deactivate |
||
12312 | bpr | 213 | !read var.proc.deactivate |
23 | reyssat | 214 | !else |
12312 | bpr | 215 | confirmed=!replace word share by $ in $confirmed |
216 | confirmed=!singlespace $confirmed |
||
23 | reyssat | 217 | !endif |
218 | |||
219 | activetest=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets |
||
220 | a_=!line 1 of $activetest |
||
221 | a_=!trim $a_ |
||
222 | expp=!line 2 of $activetest |
||
223 | !default expiration=$expp |
||
7801 | bpr | 224 | |
225 | !if $expiration>$class_expiration or $test_expire!=$empty |
||
12312 | bpr | 226 | expiration=$class_expiration |
23 | reyssat | 227 | !endif |
7801 | bpr | 228 | |
23 | reyssat | 229 | ecnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
15767 | guerimand | 230 | wims_listexo=!values v for v=1 to $ecnt |
231 | !setdef wims_listexo=$wims_listexo in wimshome/sessions/$wims_session/var.stat |
||
1513 | guerimand | 232 | activetest=!replace line number 3 by $ecnt in $activetest |
23 | reyssat | 233 | |
234 | !if $job=putsource and $a_=0 |
||
12312 | bpr | 235 | source=!trim $source |
236 | !writefile $srcname $source |
||
237 | putcnt=!recordcnt $srcname |
||
238 | !for i=1 to $putcnt |
||
239 | s_=!record $i of $srcname |
||
240 | n_=!linecnt $s_ |
||
241 | bad_source=$i |
||
13046 | bpr | 242 | !if $n_>=5 and $n_<=$sheetrecordlimit |
12312 | bpr | 243 | !distribute lines $s_ into di,pa,re,we,ti,de |
244 | !for k in re,we,di,pa,ti,de |
||
245 | $k=!trim $($k) |
||
246 | w$k=!wordcnt $($k) |
||
247 | !next k |
||
248 | !if NaN isin $[$re]$[$we] or $[$wre*$wwe*$wdi]!=1 or $wpa>1 or $ti=$empty or\ |
||
14335 | bpr | 249 | .. isin $di or $re<0 or $we<0 or ($re>0 and $we=0) |
12312 | bpr | 250 | error=bad_source |
17206 | guerimand | 251 | ssource=$source |
12312 | bpr | 252 | !exit |
253 | !endif |
||
254 | ti=!char 1 to $etitle_limit of $ti |
||
255 | de=!char 1 to $edesc_limit of $de |
||
256 | source_$i=$s_ |
||
257 | last=$i |
||
258 | !else |
||
13046 | bpr | 259 | # last record may be empty |
12312 | bpr | 260 | !if $i!=$putcnt |
261 | error=bad_source |
||
17206 | guerimand | 262 | ssource=$source |
12312 | bpr | 263 | !exit |
264 | !endif |
||
265 | !endif |
||
266 | !next i |
||
267 | !for i=1 to $last |
||
268 | !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$sheet :$(source_$i) |
||
269 | !next i |
||
17206 | guerimand | 270 | !reset ssource |
23 | reyssat | 271 | !endif |
272 | |||
273 | !if $activetest!=$empty |
||
12312 | bpr | 274 | sheet_exist=yes |
275 | !default expiration=!line 2 of $activetest |
||
276 | activetest=!line 1 of $activetest |
||
277 | exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
||
23 | reyssat | 278 | !else |
12312 | bpr | 279 | sheet_exist=no |
280 | activetest=-1 |
||
281 | exocnt=0 |
||
282 | !default expiration=$class_expiration |
||
23 | reyssat | 283 | !endif |
284 | |||
285 | !if $job=getsource and $sheet_exist=yes |
||
13640 | obado | 286 | !writefile $srcname |
12312 | bpr | 287 | !for i=1 to $exocnt |
288 | l=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
||
13640 | obado | 289 | # replace eventual html entities so it will not insert \n in textarea |
290 | l=!replace internal by $ $ in $l |
||
12312 | bpr | 291 | !appendfile $srcname $$:$l |
292 | !next i |
||
13640 | obado | 293 | !appendfile $srcname |
12312 | bpr | 294 | !exit |
23 | reyssat | 295 | !endif |
296 | |||
10062 | guerimand | 297 | !readproc adm/vfilter/listvarfilter.proc |
23 | reyssat | 298 | !if $allow=yes |
12312 | bpr | 299 | !if $tv_listname=$empty |
300 | !bound allowtype within all,none,select default all |
||
301 | !else |
||
302 | !bound allowtype within all,none,select,techvar default all |
||
303 | !endif |
||
12994 | guerimand | 304 | !read adm/scorerestriction get |
12312 | bpr | 305 | IPlist=$_output |
306 | IPlist=!translate ,;\ |
||
23 | reyssat | 307 | * to $ $ in $IPlist |
12312 | bpr | 308 | IPlist=!trim $IPlist |
309 | !if $allowtype=select and $IPlist=$empty and $save!=$empty |
||
310 | allowtype=all |
||
311 | !endif |
||
312 | !if $allowtype=all |
||
313 | allow_parm= |
||
314 | !endif |
||
315 | !if $allowtype=none |
||
316 | allow_parm=none |
||
317 | !endif |
||
318 | !if $allowtype=select |
||
319 | allow_parm=$IPlist |
||
320 | !endif |
||
10305 | guerimand | 321 | |
12312 | bpr | 322 | !if $allowtype=techvar |
323 | !readproc adm/vfilter/shexselect.proc $sheet |
||
324 | !endif |
||
10305 | guerimand | 325 | !endif |
11810 | guerimand | 326 | |
11967 | guerimand | 327 | !! --------------- get/save severity parameters |
328 | rec=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity |
||
329 | !if $save!=$empty |
||
12312 | bpr | 330 | !distribute word $df_severity into t1,t2,t3 |
331 | !bound weight between $min_weight and $max_weight default $t1 |
||
332 | !bound formulaA between integer 0 and 6 default $t2 |
||
333 | !bound formulaB between integer 0 and 2 default $t3 |
||
334 | nb=!linecnt $rec |
||
13059 | guerimand | 335 | !! define maxscore default =10 (not general variable maybe we should ?) |
336 | !if $nb=0 |
||
13060 | bpr | 337 | rec=10 |
13059 | guerimand | 338 | !endif |
12312 | bpr | 339 | new=$weight $formulaA $formulaB |
13058 | guerimand | 340 | !if $sheet>$nb-1 |
12312 | bpr | 341 | !for k=$nb+1 to $sheet+1 |
14335 | bpr | 342 | rec=!append line $df_severity to $rec |
13058 | guerimand | 343 | !next k |
12312 | bpr | 344 | !endif |
345 | rec=!replace line number $[$sheet+1] by $new in $rec |
||
346 | !writefile wimshome/log/classes/$wims_class/sheets/.severity $rec |
||
11967 | guerimand | 347 | !endif |
348 | rec=!line $[$sheet+1] of $rec |
||
349 | !distribute word $rec into s_weight,s_formulaA,s_formulaB |
||
350 | !default weight=$s_weight |
||
351 | !default formulaA=$s_formulaA |
||
352 | !default formulaB=$s_formulaB |
||
353 | |||
10062 | guerimand | 354 | !! ---- save modification of allow parameters |
10305 | guerimand | 355 | !if $save!=$empty |
10062 | guerimand | 356 | !if $sharers!=$empty and $allowshare=1 |
16798 | guerimand | 357 | !if $allowtype=techvar |
16801 | guerimand | 358 | !readproc adm/vfilter/validtechvar.proc $allowtechvar\ |
16798 | guerimand | 359 | $sharers |
360 | !if $output=1 |
||
361 | setclass=!items2words $wims_class,$sharers |
||
362 | !else |
||
363 | error=badallowshare |
||
364 | allowshare=0 |
||
365 | setclass=$wims_class |
||
366 | !endif |
||
16801 | guerimand | 367 | !else |
368 | setclass=!items2words $wims_class,$sharers |
||
16798 | guerimand | 369 | !endif |
10062 | guerimand | 370 | !else |
12312 | bpr | 371 | setclass=$wims_class |
10062 | guerimand | 372 | !endif |
373 | !if $allow_parm=$empty |
||
12312 | bpr | 374 | !sh for c in $setclass; do rm -f $wims_home/log/classes/$$c/.$sheet; done |
10062 | guerimand | 375 | !else |
16777 | guerimand | 376 | setclass=!words2items $setclass |
12312 | bpr | 377 | !for c in $setclass |
378 | !writefile wimshome/log/classes/$c/.$sheet $allow_parm |
||
379 | !next c |
||
10062 | guerimand | 380 | !endif |
381 | wims_class_log=sheet $sheet allow $allowtype $allowshare by $wims_realuser |
||
10305 | guerimand | 382 | !endif |
10062 | guerimand | 383 | !! ---- end of saving |
23 | reyssat | 384 | |
10062 | guerimand | 385 | !if $allow=$empty or $save!=$empty |
386 | !! --- read saving configuration for allow parameters initial time and after saving |
||
12312 | bpr | 387 | !readproc adm/vfilter/shexread.proc $sheet |
11810 | guerimand | 388 | !! to distribute IPlist content into variable |
12312 | bpr | 389 | !read adm/scorerestriction put\ |
11810 | guerimand | 390 | $IPlist |
10062 | guerimand | 391 | !endif |
10244 | guerimand | 392 | old_allowtype=$allowtype |
393 | old_allowtechvar=$allowtechvar |
||
10062 | guerimand | 394 | !reset allow,save |
395 | !! --- end of reading |
||
23 | reyssat | 396 | |
397 | expmon=!char 5,6 of $expiration |
||
398 | expday=!char 7,8 of $expiration |
||
399 | expyear=!char 1,2,3,4 of $expiration |
||
400 | |||
401 | !if $job!=text |
||
13640 | obado | 402 | # remove \n from textareas |
12312 | bpr | 403 | mod_desc=!replace internal $\ |
13640 | obado | 404 | $ by $ $ in $mod_desc |
12312 | bpr | 405 | mod_comment=!replace internal $\ |
13640 | obado | 406 | $ by $ $ in $mod_comment |
12312 | bpr | 407 | !if $title_save$desc_save=$empty |
408 | rec=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets |
||
13831 | bpr | 409 | !distribute lines $rec into bidon,bidon,title_save,desc_save,prpage_save,\ |
15763 | guerimand | 410 | comment_save,attribut_save,exodescshow_save,formal_hidden_condition_save,\ |
411 | indivtechvar_save |
||
15860 | guerimand | 412 | !bound indivtechvar_save within $empty,$tv_listlocalcode default $empty |
12312 | bpr | 413 | !endif |
414 | title=$title_save |
||
415 | desc=$desc_save |
||
416 | prpage=$prpage_save |
||
417 | comment=$comment_save |
||
13825 | bpr | 418 | exodescshow=$exodescshow_save |
14441 | guerimand | 419 | !readproc adm/vfilter/convertformat.proc human\ |
420 | $formal_hidden_condition_save |
||
421 | hidden_condition=$output_convertformat |
||
15763 | guerimand | 422 | indivtechvar=$indivtechvar_save |
23 | reyssat | 423 | !else |
12312 | bpr | 424 | !if $title=$empty |
425 | error=no_title |
||
426 | !exit |
||
427 | !endif |
||
12801 | obado | 428 | title=!singlespace $title |
429 | title=!char 1 to $title_limit of $title |
||
430 | title=!replace internal : by : in $title |
||
431 | |||
12312 | bpr | 432 | desc=!replace internal $\ |
13640 | obado | 433 | $ by $ $ in $desc |
12801 | obado | 434 | desc=!singlespace $desc |
435 | desc=!char 1 to $desc_limit of $desc |
||
436 | desc=!replace internal : by : in $desc |
||
437 | |||
12312 | bpr | 438 | comment=!replace internal $\ |
13640 | obado | 439 | $ by $ $ in $comment |
12312 | bpr | 440 | comment=!singlespace $comment |
12801 | obado | 441 | |
16919 | guerimand | 442 | !! --- manage of personalized presentation of sheet page |
443 | !if $prpage isitemof no,yes or $prpage=$empty |
||
444 | !bound prpage within yes,no default no |
||
445 | !else |
||
446 | !! old gestion of prpage with doc link |
||
447 | !! deprecated but keep for background compatibility |
||
448 | prpage=!word 1 of $prpage |
||
449 | prpage=!char 1 to 100 of $prpage |
||
450 | !if .. isin $prpage or / notin $prpage |
||
451 | prpage=no |
||
12312 | bpr | 452 | !endif |
16919 | guerimand | 453 | !if $prpage!=no |
454 | test=!fileexists wimshome/log/classes/$wims_class/doc/$prpage.def |
||
455 | !if $test!=yes |
||
456 | prpage=no |
||
457 | !endif |
||
458 | !endif |
||
12312 | bpr | 459 | !endif |
16919 | guerimand | 460 | |
14441 | guerimand | 461 | !if $hidden_condition!=$empty |
462 | !readproc adm/vfilter/convertformat.proc formal\ |
||
463 | $hidden_condition |
||
464 | formal_hidden_condition=$output_convertformat |
||
16195 | guerimand | 465 | !if $output_error!=$empty |
466 | error=badtechvarname $output_error |
||
467 | !endif |
||
468 | !readproc adm/vfilter/convertformat.proc human\ |
||
469 | $formal_hidden_condition |
||
470 | hidden_condition=$output_convertformat |
||
14441 | guerimand | 471 | !else |
472 | formal_hidden_condition=$empty |
||
473 | !endif |
||
15763 | guerimand | 474 | !! indivtechvar is not modifiable when sheet is activated. |
475 | !if $activetest>0 |
||
476 | rec=!record $sheet of wimshome/log/classes/$wims_class/sheets/.sheets |
||
477 | indivtechvar=!item 10 of $rec |
||
478 | !endif |
||
15860 | guerimand | 479 | !bound indivtechvar within $empty,$tv_listlocalcode default $empty |
12312 | bpr | 480 | !if $sheet_exist=yes |
481 | !distribute lines 2\ |
||
23 | reyssat | 482 | $expiration into update_field,update_content |
12312 | bpr | 483 | !read update.sheet |
12801 | obado | 484 | |
12312 | bpr | 485 | !distribute lines 3\ |
23 | reyssat | 486 | $title into update_field,update_content |
12312 | bpr | 487 | !read update.sheet |
12801 | obado | 488 | |
12312 | bpr | 489 | !distribute lines 4\ |
23 | reyssat | 490 | $desc into update_field,update_content |
12312 | bpr | 491 | !read update.sheet |
12801 | obado | 492 | |
12312 | bpr | 493 | !distribute lines 5\ |
23 | reyssat | 494 | $prpage into update_field,update_content |
12312 | bpr | 495 | !read update.sheet |
12801 | obado | 496 | |
12312 | bpr | 497 | !distribute lines 6\ |
1969 | guerimand | 498 | $comment into update_field,update_content |
12312 | bpr | 499 | !read update.sheet |
13825 | bpr | 500 | |
501 | !distribute lines 7\ |
||
502 | $attribut into update_field,update_content |
||
503 | !read update.sheet |
||
14646 | bpr | 504 | |
13825 | bpr | 505 | !distribute lines 8\ |
506 | $exodescshow into update_field,update_content |
||
507 | !read update.sheet |
||
14646 | bpr | 508 | |
14441 | guerimand | 509 | !distribute lines 9\ |
510 | $formal_hidden_condition into update_field,update_content |
||
511 | !read update.sheet |
||
512 | |||
15763 | guerimand | 513 | !if $activetest=0 |
514 | !distribute lines 10\ |
||
515 | $indivtechvar into update_field,update_content |
||
516 | !read update.sheet |
||
517 | |||
518 | !endif |
||
519 | |||
12312 | bpr | 520 | !else |
521 | !appendfile wimshome/log/classes/$wims_class/sheets/.sheets :0\ |
||
23 | reyssat | 522 | $expiration\ |
523 | $title\ |
||
524 | $desc\ |
||
1969 | guerimand | 525 | $prpage\ |
13825 | bpr | 526 | $comment\ |
527 | $attribut\ |
||
14441 | guerimand | 528 | $exodescshow\ |
15763 | guerimand | 529 | $formal_hidden_condition\ |
15859 | guerimand | 530 | $empty |
531 | indivtechvar=$empty |
||
12312 | bpr | 532 | sheet_exist=yes |
533 | activetest=0 |
||
534 | sheet=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets |
||
535 | !writefile wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
||
14242 | obado | 536 | message=$name_createok |
12312 | bpr | 537 | !endif |
538 | title_save=$title |
||
539 | desc_save=$desc |
||
540 | prpage_save=$prpage |
||
541 | comment_save=$comment |
||
13825 | bpr | 542 | attribut_save=$attribut |
543 | exodescshow_save=$exodescshow |
||
14441 | guerimand | 544 | formal_hidden_condition_save=$formal_hidden_condition |
15763 | guerimand | 545 | indivtechvar_save=$indivtechvar |
23 | reyssat | 546 | !endif |
547 | |||
16919 | guerimand | 548 | !if $job=prpage and $prpage_save=yes |
549 | test=!fileexists wimshome/sessions/$wims_session/user-deposit |
||
550 | !if $test=yes |
||
551 | msg2wims_primitives=if ifval for while\ |
||
552 | reload fold ref link docform form resource calcform embed\ |
||
553 | exercise tool doc example help adm tooltip href slib\ |
||
554 | def define comment draw canvasdraw audio glossary |
||
555 | !sh rm -f $wims_home/$wims_sesdir/sheet$(sheet).def;\ |
||
556 | $wims_home/bin/msg2wims $wims_home/$wims_sesdir/user-deposit $wims_home/$wims_sesdir/sheet$(sheet).def;\ |
||
557 | if [ -e $wims_home/$wims_sesdir/sheet$(sheet).def ]; then\ |
||
558 | mv $wims_home/$wims_sesdir/sheet$(sheet).def $wims_home/log/classes/$wims_class/sheets/sheet$(sheet).def;\ |
||
559 | mv $wims_home/$wims_sesdir/user-deposit $wims_home/log/classes/$wims_class/sheets/sheet$(sheet).src;\ |
||
560 | else\ |
||
561 | rm -f $wims_home/$wims_sesdir/user-deposit;\ |
||
562 | fi; |
||
563 | !endif |
||
564 | !endif |
||
565 | |||
23 | reyssat | 566 | !if $job=activate and $[$activetest]=0 |
15859 | guerimand | 567 | !read adm/sheet/checkdepindiv |
568 | !if $sheet isitemof $sheet_dependancy and $sheet isitemof $sheet_indivtechvar |
||
569 | error=depindiv |
||
570 | !reset job |
||
571 | !exit |
||
572 | !endif |
||
15857 | guerimand | 573 | !read adm/sheet/writeweights |
12312 | bpr | 574 | !if $test_expire!=$empty |
575 | !distribute items 2,$expiration into update_field,update_content |
||
7801 | bpr | 576 | !read update.sheet |
577 | !reset test_expire |
||
12312 | bpr | 578 | !endif |
579 | !distribute item 1,1 into update_field,update_content |
||
580 | !read update.sheet |
||
581 | activetest=1 |
||
582 | wims_class_log=activate sheet $sheet by $wims_realuser |
||
23 | reyssat | 583 | !endif |
584 | |||
13208 | obado | 585 | !! only delete or move items when sheet has not been activated |
586 | !if $activetest=0 |
||
587 | # delete an item |
||
588 | !if $job=delete and $delete>0 and $delete<=$exocnt |
||
14105 | guerimand | 589 | !read adm/sheet/sheetexam.shift sheet,$sheet,,$delete |
13208 | obado | 590 | delete= |
591 | exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
||
592 | !endif |
||
23 | reyssat | 593 | |
14104 | guerimand | 594 | # move to specific position |
14113 | guerimand | 595 | !if $job=moveto and $movetarget>=1 and $movetarget<=$[$exocnt+1] and $movesource!=$movetarget and $movesource>=1 and $movesource<=$exocnt |
14105 | guerimand | 596 | !read adm/sheet/sheetexam.shift sheet,$sheet,$movetarget,$movesource |
14104 | guerimand | 597 | !endif |
598 | |||
15763 | guerimand | 599 | # change individualisation of sheet with a technical variable |
15860 | guerimand | 600 | !if $job=indiv and $indivtechvar!=0 and $indivtechvar!=$empty |
15763 | guerimand | 601 | !read indiv.proc |
602 | !endif |
||
16022 | bpr | 603 | |
13432 | bpr | 604 | !endif |
605 | |||
23 | reyssat | 606 | # modify an item |
607 | !if $job=modify and $modif>0 and $modif<=$exocnt |
||
12312 | bpr | 608 | !if $activetest=0 |
609 | exo=!record $modif of wimshome/log/classes/$wims_class/sheets/.sheet$sheet |
||
610 | !distribute lines $exo into D_,p_ |
||
13315 | bpr | 611 | #### |
12312 | bpr | 612 | iniparm=$p_ |
12387 | bpr | 613 | !read getparm $iniparm exo random qnum exotrymax |
12312 | bpr | 614 | exocnt_=!itemcnt $get_exo |
13315 | bpr | 615 | #### common with addmodule |
12387 | bpr | 616 | iniparm2=!replace internal & by $\ |
617 | $ in $iniparm |
||
618 | iniparm2_cnt=!linecnt $iniparm2 |
||
619 | new_iniparm= |
||
620 | equal== |
||
12312 | bpr | 621 | !if $get_random=0 |
622 | !for i=1 to $get_qnum |
||
16037 | bpr | 623 | update_order=!append item $(update_ex$i) to $update_order |
12312 | bpr | 624 | !next |
625 | get_exo=$(get_exo[$update_order]) |
||
626 | !for v in $get_exo |
||
13760 | bpr | 627 | new_iniparm=!append line exo=$v to $new_iniparm |
12312 | bpr | 628 | !next |
629 | !for u=1 to $iniparm2_cnt |
||
630 | l=!line $u of $iniparm2 |
||
631 | !if exo$equal notin $l |
||
13760 | bpr | 632 | new_iniparm=!append line $l to $new_iniparm |
12312 | bpr | 633 | !endif |
634 | !next |
||
13760 | bpr | 635 | new_iniparm=!replace internal $\ |
636 | $ by & in $new_iniparm |
||
12312 | bpr | 637 | new_iniparm=!nospace $new_iniparm |
638 | p_=$new_iniparm |
||
7354 | bpr | 639 | !endif |
12387 | bpr | 640 | !if $get_exotrymax!=$mod_exotrymax |
641 | tmp=!nospace $mod_exotrymax |
||
642 | !if exotrymax isin $p_ |
||
13315 | bpr | 643 | !if $tmp!=$empty |
644 | p_=!replace internal exotrymax=$get_exotrymax by exotrymax=$tmp in $p_ |
||
645 | !else |
||
646 | p_=!replace internal exotrymax=$get_exotrymax by in $p_ |
||
647 | !endif |
||
12400 | bpr | 648 | !else |
12387 | bpr | 649 | !if $tmp!=$empty |
12400 | bpr | 650 | p_=$p_&exotrymax=$tmp |
12387 | bpr | 651 | !reset mod_exotrymax |
652 | !endif |
||
653 | !endif |
||
654 | p_=!nospace $p_ |
||
12400 | bpr | 655 | p_=!replace internal && by & in $p_ |
12387 | bpr | 656 | !reset tmp |
657 | !endif |
||
658 | |||
13315 | bpr | 659 | ##### |
15910 | guerimand | 660 | mod_indiv=!listintersection $mod_indiv and $listval |
661 | !bound mod_weight between $min_weight and $max_weight default 1 |
||
12312 | bpr | 662 | !bound mod_require between 0 and $[10*$require_limit] default 0 |
15910 | guerimand | 663 | !if $mod_indiv!=$empty |
16022 | bpr | 664 | nbvalue=!itemcnt $listval |
15910 | guerimand | 665 | !distribute item $max_weight,$[10*$require_limit],$min_weight,0 into limitM_weight,limitM_require,limitm_weight,limitm_require |
666 | !for type in weight,require |
||
667 | tmp=$(mod_$type) |
||
668 | !for k=1 to $nbvalue |
||
669 | !bound $type$k between $(limitm_$type) and $(limitM_$type) default $tmp |
||
670 | !if $($type$k)!=$tmp |
||
671 | mod_$type=$(mod_$type);$(listval[$k]),$($type$k) |
||
672 | !endif |
||
673 | !next k |
||
16022 | bpr | 674 | !next type |
15910 | guerimand | 675 | !endif |
12312 | bpr | 676 | mod_title=!singlespace $mod_title |
677 | mod_desc=!singlespace $mod_desc |
||
678 | mod_comment=!singlespace $mod_comment |
||
679 | mod_title=!char 1 to $etitle_limit of $mod_title |
||
680 | mod_desc=!char 1 to $edesc_limit of $mod_desc |
||
681 | mod_comment=!char 1 to $edesc_limit of $mod_comment |
||
4528 | bpr | 682 | !endif |
12312 | bpr | 683 | !if $mod_feedback notsametext $empty |
14646 | bpr | 684 | !reset mod_feedback_tmp |
685 | tmpcnt=!itemcnt $(mod_feedback[;1]) |
||
686 | !for t_=1 to $tmpcnt |
||
687 | mod_feedback_=$(mod_feedback[$t_;]) |
||
688 | mod_feedback_lim=$(mod_feedback_[2]) |
||
689 | mod_feedback_lim2=$(mod_feedback_[3]) |
||
690 | !bound mod_feedback_lim between 0 and 11 default 10 |
||
691 | !bound mod_feedback_lim2 between 0 and $mod_feedback_lim default 0 |
||
692 | mod_feedback_=!nospace $(mod_feedback_[1]) |
||
693 | mod_feedback_test=!replace = by _ in $mod_feedback_ |
||
694 | !if cmd_new notin $mod_feedback_test |
||
695 | mod_feedback_=!nospace $mod_feedback_&cmd=new |
||
696 | !endif |
||
697 | !if adm/doc isin $mod_feedback_ and job_read notin $mod_feedback_test |
||
698 | mod_feedback_=$mod_feedback_&job=read |
||
699 | !endif |
||
700 | mod_feedback_tmp=!append line $mod_feedback_,$mod_feedback_lim,$mod_feedback_lim2 to $mod_feedback_tmp |
||
701 | !next |
||
702 | mod_feedback=!lines2rows $mod_feedback_tmp |
||
4528 | bpr | 703 | !endif |
7290 | bpr | 704 | |
12312 | bpr | 705 | exo=$modif |
706 | !if $activetest=0 |
||
707 | update_content=$D_\ |
||
23 | reyssat | 708 | $p_\ |
709 | $mod_require\ |
||
710 | $mod_weight\ |
||
711 | $mod_title\ |
||
712 | $mod_desc\ |
||
1969 | guerimand | 713 | $mod_dep\ |
4528 | bpr | 714 | $mod_comment\ |
12316 | bpr | 715 | $mod_feedback\ |
15763 | guerimand | 716 | $mod_attribut\ |
717 | $mod_indiv |
||
12312 | bpr | 718 | update_field=0 |
719 | !read adm/class/update.exo |
||
4864 | bpr | 720 | !else |
12312 | bpr | 721 | !distribute lines 5\ |
7290 | bpr | 722 | $mod_title into update_field,update_content |
12312 | bpr | 723 | !read adm/class/update.exo |
724 | !distribute lines 6\ |
||
7290 | bpr | 725 | $mod_desc into update_field,update_content |
12312 | bpr | 726 | !read adm/class/update.exo |
727 | !distribute lines 8\ |
||
7290 | bpr | 728 | $mod_comment into update_field,update_content |
12312 | bpr | 729 | !read adm/class/update.exo |
730 | !distribute lines 9\ |
||
7290 | bpr | 731 | $mod_feedback into update_field,update_content |
12312 | bpr | 732 | !read adm/class/update.exo |
12316 | bpr | 733 | !distribute lines 10\ |
734 | $mod_attribut into update_field,update_content |
||
735 | !read adm/class/update.exo |
||
12312 | bpr | 736 | !endif |
7290 | bpr | 737 | |
12316 | bpr | 738 | !distribute items $ into mod_title,mod_desc,mod_weight,mod_require,mod_dep,\ |
15763 | guerimand | 739 | mod_comment,mod_feedback,mod_attribut,mod_indiv |
23 | reyssat | 740 | !endif |
741 | |||
742 | !if $[$activetest]=0 |
||
12312 | bpr | 743 | erasable=yes |
744 | scnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheets |
||
745 | !for s=$sheet+1 to $scnt |
||
746 | l=!record $s of wimshome/log/classes/$wims_class/sheets/.sheets |
||
747 | l=!line 1 of $l |
||
748 | !if $l>0 |
||
749 | erasable=no |
||
750 | !endif |
||
751 | !next s |
||
23 | reyssat | 752 | !endif |
753 | |||
3245 | guerimand | 754 | !if $back=1 and $error=$empty |
12312 | bpr | 755 | !restart module=home |
7020 | bpr | 756 | !endif |