Rev 11380 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3261 | obado | 1 | ################ UPDATE.PROC #################### |
11380 | obado | 2 | # Procedure generique de modification/suppression pour feuille et exam |
3 | # |
||
3261 | obado | 4 | # pre-requis : |
14384 | obado | 5 | # $type doit etre specifie (exams ou sheets) |
11380 | obado | 6 | # $wims_class is the current class |
7 | # $qsheet or $qexam : element to be modified |
||
8 | # $update_field is the line number of field to update |
||
9 | # If update_field=0, the element is deleted. |
||
10 | # $update_content is the new content. |
||
3261 | obado | 11 | # |
12 | |||
13 | !if $type=$empty |
||
11380 | obado | 14 | error=No type defined in update.proc |
15 | !exit |
||
3261 | obado | 16 | !endif |
17 | |||
18 | !if $type=sheets |
||
11380 | obado | 19 | qrecord=$qsheet |
20 | !else |
||
21 | qrecord=$qexam |
||
3261 | obado | 22 | !endif |
23 | |||
24 | listfile=wimshome/log/classes/$wims_class/$type/.$type |
||
25 | cnt=!recordcnt $listfile |
||
26 | |||
27 | !ifval $qrecord>$cnt |
||
11380 | obado | 28 | error=element #$qrecord of type $type does not exist (in update.proc) |
29 | !exit |
||
3261 | obado | 30 | !endif |
31 | |||
11380 | obado | 32 | # On commence par remplir les valeurs _x par l'enregistrement correspondant dans l'index |
3261 | obado | 33 | !for s=1 to $cnt |
11380 | obado | 34 | record_$s=!record $s of $listfile |
35 | record_$s=!line 1 to 7 of $(record_$s)\ |
||
3261 | obado | 36 | \ |
37 | \ |
||
38 | \ |
||
39 | \ |
||
40 | \ |
||
41 | \ |
||
42 | |||
43 | !next s |
||
44 | |||
45 | !if $update_field!=0 |
||
11380 | obado | 46 | record_$qrecord=!replace line number $update_field by $update_content in $(record_$qrecord) |
3261 | obado | 47 | !endif |
48 | |||
11380 | obado | 49 | # On peut alors reconstruire le fichier d'index des feuilles |
3261 | obado | 50 | !writefile $listfile |
51 | !for s=1 to $cnt |
||
11380 | obado | 52 | !if $update_field!=0 or $s!=$qrecord |
53 | sf=!line 1 to 5 of $(record_$s) |
||
54 | !appendfile $listfile :$sf\ |
||
3261 | obado | 55 | |
11380 | obado | 56 | !endif |
57 | !next s |