Subversion Repositories wimsdev

Rev

Rev 15985 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5374 bpr 1
!default wims_superclass=$wims_class
2
!read adm/class/userisinclass $wims_superclass,$getuser
3
!set class_Supervisor=!defof class_Supervisor in wimshome/log/classes/$wims_class/.def
862 guerimand 4
!if yes notin $script_reply
12466 bpr 5
  error=bad_usercls
6
  !reset job,getuser
7
  !exit
862 guerimand 8
!endif
23 reyssat 9
!read adm/class/userdef classes,$wims_class,$getuser
10
!defread $userdef
12072 guerimand 11
!read adm/class/initclass $wims_class
12934 guerimand 12
regvars_cnt=!itemcnt $regvars_class
23 reyssat 13
 
14
!if $user_exists!=yes or $abandon!=$empty
12466 bpr 15
  !reset up_lastname,up_firstname,up_email,up_regnum,up_photourl,up_comments,up_vars,up_external_auth,up_supervise
16
  !if $wims_user=supervisor
17
    !bound oldjob within userlist,teacher default userlist
18
    job=$oldjob
19
    !changeto $job.proc
20
    !exit
21
  !else
22
    job=getuser
23
    lastname=$user_lastname
24
    firstname=$user_firstname
25
    !! BUGTOFIX : this file don't exists (20160409)
26
    !changeto var.proc.getuser
27
  !endif
23 reyssat 28
!endif
29
 
13164 guerimand 30
!if $wims_user=supervisor
31
  allowchange=yes
32
!endif
23 reyssat 33
!if $wims_user=supervisor and $getuser!=supervisor
12466 bpr 34
  user_vars=!sh grep -E '^!set user__' $Userdef | sed 's/^!set user__//g'
23 reyssat 35
!endif
36
 
13227 guerimand 37
!if $job2=photoerase
38
  !if $wims_user=supervisor or $allowchange=yes
39
    up_photourl=
40
    !sh rm -f $wims_home/log/classes/$photodir/photoboard/$getuser
41
    !reset reg
42
    replacelist=photourl
43
  !else
44
    !reset job2,reg
12466 bpr 45
  !endif
12070 guerimand 46
!endif
47
 
12056 guerimand 48
!! make list of name of classes,program etc...
12057 guerimand 49
!readproc mksubclslist.proc
12056 guerimand 50
 
23 reyssat 51
!if $reg!=$empty
12466 bpr 52
  up_password=
15966 czzmrn 53
  replacelist=regnum,comments,photourl,email,external_auth,supervise,participate
12466 bpr 54
  !for r in $replacelist
5374 bpr 55
    !default up_$r=$(user_$r)
12466 bpr 56
  !next r
12934 guerimand 57
  !for i=1 to $[min($limit_regvars,$regvars_cnt)]
58
    !default up_regprop$i=$(regprop$i)
59
  !next i
12466 bpr 60
  replacelist=$replacelist,supervise
61
  !! ------------- manage modification of user_supervise for teacher account
62
  !if $wims_user=supervisor or ($wims_realuser!=supervisor and $wims_realuser!=$empty)
63
    !if $superv=no
64
      !set up_supervise=!listcomplement $wims_class in $up_supervise
12056 guerimand 65
    !else
12466 bpr 66
      !if $wims_user=supervisor and $wims_realuser!=supervisor
67
        !!not administrator of the portail
68
        !set up_supervise=!listuniq $wims_class, $(user_supervise)
69
      !else
15966 czzmrn 70
        !! tested in groupements, needs to be checked in portals
71
	!! (in portals some zones can have $type_class=1)
72
        !if $type_class=1
73
          !set up_supervise=!listuniq $wims_class,$(up_supervise)
74
        !else
75
          !set up_supervise=!listuniq $(up_supervise)
76
	!endif
12466 bpr 77
      !endif
12056 guerimand 78
    !endif
12466 bpr 79
    !if $up_supervise=$empty
80
      up_supervise=noclass
81
    !endif
82
  !endif
5480 bpr 83
 
12466 bpr 84
  !! ------------- manage modification of user_participate for teacher account
12072 guerimand 85
  !if ($wims_realuser=supervise or $wims_realuser=$class_Supervisor) and $type_class=1
12466 bpr 86
    replacelist=$replacelist,participate
87
    !if $superp=no
88
      !set up_participate=!listcomplement $wims_class in $user_participate
89
    !else
90
      !set up_participate=!listuniq $wims_class,$user_participate
91
    !endif
92
    !if $up_participate=$empty
93
      up_participate=noclass
94
    !endif
95
  !endif
12072 guerimand 96
 
12466 bpr 97
  !set up_external_auth=!lowercase $up_external_auth
98
  !!-------------------- photo file process management
99
  !if noname.file notin $wims_deposit and $wims_deposit!=$empty
12002 guerimand 100
    type=!sh file --mime-type $wims_home/$wims_sesdir/user-deposit | awk '{print $$2}'
101
    !if image/ notin $type
12466 bpr 102
      error=badimgformat
12002 guerimand 103
    !else
12466 bpr 104
      size=!sh mkdir -p $wims_home/log/classes/$photodir/photoboard\
12002 guerimand 105
convert $wims_home/$wims_sesdir/user-deposit -resize 132x170 $wims_home/$wims_sesdir/user-deposit\
106
ls -s $wims_home/$wims_sesdir/user-deposit | awk '{print $$1}'
14335 bpr 107
      !if $size>100
108
        error=filetoobig
109
      !else
110
        !readproc adm/class/quotafree.proc proc
111
        !if $[$wims_class_quota-$quota_free-$size]<0
112
          error=quota_file
113
        !else
114
          !sh rm -f $wims_home/log/classes/$photodir/photoboard/$getuser\
12002 guerimand 115
mv $wims_home/$wims_sesdir/user-deposit $wims_home/log/classes/$photodir/photoboard/$getuser
14335 bpr 116
          up_photourl=
117
        !endif
118
      !endif
12002 guerimand 119
    !endif
12466 bpr 120
  !else
12020 guerimand 121
    !if $up_photourl!=$user_photourl
14335 bpr 122
      !sh rm -f $wims_home/log/classes/$photodir/photoboard/$getuser
12020 guerimand 123
    !endif
12466 bpr 124
  !endif
125
  !!----------------------   end photo file
12018 guerimand 126
!endif
127
 
128
!if $reg!=$empty or $job2=photoerase
12466 bpr 129
  !read adm/class/adduser $getuser
130
  !read adm/class/mkuserlist
131
  !if $class_type isin 1234
132
    !read adm/gateway/mkteacherlist
133
  !endif
134
  !read adm/class/stat
12934 guerimand 135
  listerase=!makelist user_regprop i for i=1 to $[min($limit_regvars,$regvars_cnt)]
136
  listerase=!nospace $listerase
12466 bpr 137
  !reset user_lastname, user_firstname, user_email, user_regnum, user_photourl, user_comments,\
16250 guerimand 138
     user_supervisable, user_supervise, user_participate, user_external_auth,wims_deposit,$listerase,user_mkclass
12466 bpr 139
  !defread $userdef
140
  !if $wims_user=supervisor and $getuser!=supervisor
141
    user_vars=!sh grep -E '^!set user__' $Userdef | sed 's/^!set user__//g'
142
  !endif
23 reyssat 143
!endif
144
 
8992 guerimand 145
!reset up_lastname,up_firstname,up_email,up_regnum,up_comments_$(wims_class),up_photourl,up_vars,up_external_auth,\
16250 guerimand 146
  up_supervise,job2,reg,up_participate,up_mkclass