Subversion Repositories wimsdev

Rev

Rev 11380 | Go to most recent revision | Details | Last modification | View Log | RSS feed

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