Subversion Repositories wimsdev

Rev

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

Rev Author Line No. Line
4561 obado 1
# ModSheet
2
# Modifie la feuille $qsheet
3261 obado 3
 
4561 obado 4
#Pour commencer, on verifie la classe
5
!read scripts/check.class
6
!if $error!=$empty
7
 !exit
8
!endif
3261 obado 9
 
4783 obado 10
#Puis la feuille
3261 obado 11
type=sheets
12
!read scripts/check.proc
13
!if $error!=$empty
14
 !exit
15
!endif
16
 
17
data1=!nonempty lines $data1
10935 obado 18
 
3261 obado 19
n=!linecnt $data1
20
nbdefs=0
21
 
22
listfile=wimshome/log/classes/$qclass/exams/.exams
23
examcnt=!recordcnt $listfile
24
listexos=wimshome/log/classes/$qclass/sheets/.sheet$qsheet
25
exocnt=!recordcnt $listexos
26
 
27
!for i=1 to $n
28
  l=!line $i of $data1
29
  l=!translate = to $\
30
$ in $l
11095 obado 31
  !distribute lines $l into name_,value_
32
  name_=!word 1 of $name_
33
  !! remove leading, ending and multiples spaces
34
  value_=!trim $value_
35
  value_=!singlespace $value_
36
 
3261 obado 37
  nbtot=!itemcnt $sheetdefs
9689 obado 38
 
3261 obado 39
  !for numfield=1 to $nbtot
40
    defcur=!item $numfield of $sheetdefs
11095 obado 41
    !if $name_ = $defcur
42
      !if $defcur issametext status
3261 obado 43
        ####################
4176 obado 44
        # il faudrait verifier qu'il n'y a aucune note sur cette feuille avant de la repasser en preparation. si c'est le cas, il faut basculer les notes en question du dossier /score vers /noscore avec les options "deact noscore" en plus.
3261 obado 45
        ###################
9689 obado 46
 
11095 obado 47
        # Le statut d'une feuille est forcement >=0 et <4
48
   	    !ifval $value_<0 or $value_>=4
49
   	      error=bad status ($value_)
3261 obado 50
   	      !exit
51
        !endif
9689 obado 52
 
3261 obado 53
        #attention : avant de definir le statut a 0, il faut verifier qu'aucun examen ne fait appel a cette feuille
11095 obado 54
        !ifval $value_=0
3261 obado 55
        #cas ou on desactive une feuille
56
          !for x=1 to $examcnt
57
            qexam=$x
58
 
59
            !read scripts/listlinks.proc
60
   	        !if $nblink>0
61
   	          error=Some exercices($nblink) in this sheet($qsheet) are in an exam($qexam).You can't deactiv this sheet.
62
   	          !exit
63
            !endif
64
          !next x
5665 obado 65
          wims_class_log=Deactivate sheet $qsheet by $wims_realuser
66
 
3261 obado 67
        !else
68
        #cas ou on active une feuille
69
          !if $exocnt<1
70
            error=you can't active an empty sheet
71
            !exit
72
          !endif
15857 guerimand 73
          !read adm/sheet/writeweights
5665 obado 74
          wims_class_log=activate sheet $qsheet by $wims_realuser
3261 obado 75
        !endif
76
      !endif
77
      !advance nbdefs
78
      update_field=$numfield
11095 obado 79
      update_content=$value_
3261 obado 80
      !read scripts/update.proc
81
    !endif
82
  !next numfield
83
!next i
84
 
85
!if $nbdefs<1
86
 error=nothing done
87
 !exit
88
!endif
89
 
90
type=sheets
91
!read scripts/build_index.proc