Rev 15485 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | |
2 | !if $wims_superclass=$empty or $wims_user!=supervisor or $wims_read_parm=$empty |
||
14336 | bpr | 3 | !exit |
20 | reyssat | 4 | !endif |
5 | |||
6 | !distribute item $wims_read_parm into ac_prog, ac_class |
||
7 | !if $ac_prog= or $ac_class= or \ |
||
14336 | bpr | 8 | $wims_class/ notin $wims_superclass/$ac_prog/ $wims_superclass/$ac_class/ |
12981 | bpr | 9 | !exit |
20 | reyssat | 10 | !endif |
11 | ac_Level=$wims_superclass |
||
12 | ac_Level_=wimshome/log/classes/$ac_Level |
||
13 | ac_course=!translate internal / to , in $ac_prog |
||
14 | ac_course=!item -1 of $ac_course |
||
15 | userdir=wimshome/log/classes/$wims_superclass/.users |
||
16 | course_sup=!defof class_Supervisor in $ac_Level_/$ac_prog/.def |
||
17 | suptest= |
||
18 | !if $course_sup!=supervisor and $course_sup!=$empty |
||
12981 | bpr | 19 | suptest=!defof user_exists in wimshome/log/classes/$wims_superclass/.users/$course_sup |
20 | reyssat | 20 | !endif |
21 | !if $suptest!=yes |
||
12981 | bpr | 22 | course_sup=supervisor |
20 | reyssat | 23 | !endif |
24 | sup_=$course_sup |
||
25 | course_sup= |
||
26 | |||
27 | ac_tt= |
||
28 | test=!defof class_defined in $ac_Level_/$ac_class/$ac_course/.def |
||
29 | ac_style=!defof class_progstyle in $ac_Level_/$ac_prog/.def |
||
30 | !if $test=yes |
||
12981 | bpr | 31 | test=!defof class_ocourses in $ac_Level_/$ac_class/.def |
32 | !if $ac_class/$ac_course notin $test and mandatory notwordof $ac_style |
||
33 | !for ac_tt in b,c,d,e,f,g,h,i,j |
||
34 | test=!defof class_defined in $ac_Level_/$ac_class/$ac_course$ac_tt/.def |
||
35 | !if $test!=yes |
||
36 | ac_course=$ac_course$ac_tt |
||
37 | !goto recourse |
||
38 | !endif |
||
39 | !next ac_tt |
||
40 | error=course_full |
||
41 | !exit |
||
42 | !endif |
||
43 | error=addcourse_already |
||
20 | reyssat | 44 | !exit |
45 | !endif |
||
46 | :recourse |
||
47 | |||
48 | 1=!defof user_exists in $userdir/$sup_ |
||
49 | !if $1!=yes |
||
14336 | bpr | 50 | s_=supervisor |
20 | reyssat | 51 | !else |
14336 | bpr | 52 | 1=!defof user_supervisable in $userdir/$sup_ |
53 | !if $1!=yes |
||
54 | name=$sup_ |
||
55 | error=not_supervisable |
||
56 | !exit |
||
57 | !endif |
||
58 | slist=!defof user_supervise in $userdir/$sup_ |
||
59 | slist=!listunion $slist and $ac_Level/$ac_class/$ac_course |
||
60 | !setdef !set user_supervise=$slist in $userdir/$sup_ |
||
20 | reyssat | 61 | !endif |
62 | |||
63 | !readdef $ac_Level_/$ac_prog/.def |
||
64 | cadd_dc=!defof class_description in $ac_Level_/$ac_class/.def |
||
65 | cadd_dc=!word 1 of $cadd_dc |
||
66 | !for t in supervisor Supervisor, email, password, expiration, level |
||
14336 | bpr | 67 | cadd_$t=$(class_$t) |
20 | reyssat | 68 | !next t |
69 | cadd_secure=$sechost |
||
70 | !default cadd_secure=$class_secure |
||
71 | cadd_description=$cadd_dc-$class_description |
||
72 | !if $ac_tt!=$empty |
||
14336 | bpr | 73 | cadd_description=$cadd_description-$ac_tt |
20 | reyssat | 74 | !endif |
75 | class_password= |
||
76 | cadd_password= |
||
77 | cadd_superclass=$wims_superclass |
||
78 | cadd_parent=$wims_superclass/$ac_class |
||
79 | cadd_type=1 |
||
80 | cadd_typename=course |
||
81 | !readdef $ac_Level_/$ac_prog/supervisor |
||
82 | !for t in lastname, firstname, password, email |
||
14336 | bpr | 83 | sadd_$t=$(user_$t) |
20 | reyssat | 84 | !next t |
85 | |||
86 | !if $passs!=$empty |
||
14336 | bpr | 87 | c=!char 1 of $passs |
88 | !if $c=* |
||
89 | passs=!text select */$char_passwd in $passs |
||
90 | !else |
||
91 | passs=!text select $char_passwd in $passs |
||
92 | !endif |
||
15485 | bpr | 93 | passlen=!charcnt $passs |
14336 | bpr | 94 | !if $passlen<$passwd_min or $passlen>$passwd_max or $passs != $passs2 |
95 | error=bad_password |
||
96 | !exit |
||
97 | !endif |
||
98 | sadd_password=$passs |
||
20 | reyssat | 99 | !endif |
100 | |||
101 | !read adm/class/addclass $ac_Level/$ac_class/$ac_course |
||
102 | |||
103 | !setdef n_part=$ac_Level/$ac_class\ |
||
104 | n_sup=$ac_Level/$ac_class,$ac_Level/$ac_prog in $ac_Level_/$ac_class/$ac_course/neighbors |
||
105 | ac_n=!defof n_part\ |
||
106 | n_sup in $ac_Level_/$ac_class/neighbors |
||
107 | !distribute lines $ac_n into n_part, n_sup |
||
108 | n_part=!listunion $n_part and $ac_Level/$ac_class/$ac_course |
||
109 | n_sup =!listunion $n_sup and $ac_Level/$ac_class/$ac_course |
||
110 | !setdef n_part=$n_part\ |
||
111 | n_sup=$n_sup in $ac_Level_/$ac_class/neighbors |
||
112 | |||
113 | n_sup=!defof n_sup in $ac_Level_/$ac_prog/neighbors |
||
114 | n_sup=!listunion $n_sup and $ac_Level/$ac_class/$ac_course |
||
115 | !setdef n_sup=$n_sup in $ac_Level_/$ac_prog/neighbors |
||
116 | !read adm/class/addshare $ac_Level/$ac_prog, $ac_Level/$ac_class/$ac_course\ |
||
16708 | guerimand | 117 | exo,sheet,exam,doc,vote,livret,seq,freework |
20 | reyssat | 118 | |
119 | ac_style=!defof class_progstyle in $ac_Level_/$ac_prog/.def |
||
120 | !if mandatory iswordof $ac_style |
||
14336 | bpr | 121 | ocourses=!defof class_ocourses in $ac_Level_/$ac_class/.def |
122 | ocourses=!listunion $ocourses and $ac_class/$ac_course |
||
123 | !setdef !set class_ocourses=$ocourses in $ac_Level_/$ac_class/.def |
||
124 | !sh cd $wims_home/log/classes/$ac_Level/$ac_class/$ac_course\ |
||
125 | rm -f .userlist\ |
||
126 | ln -s ../.userlist . |
||
20 | reyssat | 127 | !endif |
128 |