Rev 12981 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | # Add a class under the current level. |
2 | # Calling parameter: supervisor_account,title,... |
||
3 | |||
4 | !if $wims_superclass=$empty or $wims_user!=supervisor or \ |
||
14336 | bpr | 5 | $level=$empty or $wims_class/ notin $wims_superclass/$level/ |
12981 | bpr | 6 | !exit |
20 | reyssat | 7 | !endif |
8 | |||
9 | Level_=$wims_superclass/$level |
||
10 | Level__=wimshome/log/classes/$Level_ |
||
11 | userdir=wimshome/log/classes/$wims_superclass/.users |
||
12 | s_=!item 1 of $wims_read_parm |
||
13 | titles=!item 2 to -1 of $wims_read_parm |
||
14 | L=!record 0 of $Level__/classes |
||
15 | L=!translate internal / to , in $L |
||
16 | L=!column 2 of $L |
||
17 | A=!values x for x=101 to 199 |
||
18 | N=!listcomplement $L in $A |
||
19 | newclasses=!sort numeric items $N |
||
20 | avcnt=!itemcnt $newclasses |
||
21 | newcnt=!itemcnt $titles |
||
22 | progs=!record 0 of $Level__/programs |
||
23 | progs=!column 1 of $progs |
||
24 | progs=!nonempty items $progs |
||
25 | !for p_ in $progs |
||
12981 | bpr | 26 | progstyle_$p_=!defof class_progstyle in $Level__/$p_/.def |
20 | reyssat | 27 | !next p_ |
28 | |||
29 | !if $pass!=$empty |
||
12981 | bpr | 30 | pass=!text select $char_passwd in $pass |
31 | passlen=!charcnt $pass |
||
32 | !if $passlen<$passwd_min or $passlen>$passwd_max or $pass != $pass2 |
||
33 | error=bad_password |
||
34 | !exit |
||
35 | !endif |
||
20 | reyssat | 36 | !else |
12981 | bpr | 37 | pass=!defof class_password in $Level__/.def |
20 | reyssat | 38 | !endif |
39 | |||
40 | !if $passs!=$empty |
||
12981 | bpr | 41 | passs=!text select $char_passwd in $passs |
42 | passlen=!charcnt $passs |
||
43 | !if $passlen<$passwd_min or $passlen>$passwd_max or $passs != $passs2 |
||
44 | error=bad_password |
||
45 | !exit |
||
46 | !endif |
||
20 | reyssat | 47 | !else |
12981 | bpr | 48 | passs=!defof user_password in $Level__/supervisor |
20 | reyssat | 49 | !endif |
50 | |||
51 | !if $newclasses=$empty or $avcnt<$newcnt |
||
12981 | bpr | 52 | error=class_full |
53 | !exit |
||
20 | reyssat | 54 | !endif |
55 | |||
56 | 1=!defof user_exists in wimshome/log/classes/$wims_superclass/.users/$s_ |
||
57 | ac_su_list= |
||
58 | !if $1!=yes |
||
12981 | bpr | 59 | s_=supervisor |
60 | ac_su_class= |
||
20 | reyssat | 61 | !else |
12981 | bpr | 62 | 1=!defof user_supervisable in wimshome/log/classes/$wims_superclass/.users/$s_ |
63 | !if $1!=yes |
||
64 | name=$s_ |
||
65 | error=not_supervisable |
||
66 | !exit |
||
67 | !endif |
||
68 | ac_su_class=yes |
||
20 | reyssat | 69 | !endif |
70 | |||
71 | !read adm/class/userdef classes,$wims_superclass,$s_ |
||
72 | userdef_save=$userdef |
||
73 | sup_save=$s_ |
||
74 | !for i=1 to $newcnt |
||
12981 | bpr | 75 | userdef=$userdef_save |
76 | cadd_Supervisor=$sup_save |
||
77 | tmp=!defof user_firstname,user_lastname,user_email,user_password in $userdef |
||
78 | !distribute item $tmp into sadd_firstname,sadd_lastname,sadd_email,sadd_password |
||
79 | cadd_email=$sadd_email |
||
80 | cadd_superclass=$wims_superclass |
||
81 | cadd_parent=$Level_ |
||
82 | cadd_password=$pass |
||
83 | cadd_secure=$sechost |
||
84 | sadd_password=$passs |
||
85 | cadd_type=3 |
||
86 | cadd_typename=class |
||
87 | cadd_description=!item $i of $titles |
||
88 | ac_newclass=!item $i of $newclasses |
||
89 | ac_su_list=!listunion $ac_su_list and $Level_/$ac_newclass |
||
90 | !read adm/class/addclass $Level_/$ac_newclass |
||
91 | !for p_ in $progs |
||
92 | progstyle=!defof class_progstyle in wimshome/log/classes/$wims_superclass/$p_/.def |
||
93 | !if all iswordof $progstyle |
||
94 | passs=!defof user_password in wimshome/log/classes/$wims_superclass/$p_/supervisor |
||
95 | passs2=$passs |
||
96 | !read adm/gateway/addcourse $p_, $level/$ac_newclass |
||
97 | !endif |
||
98 | !next p_ |
||
20 | reyssat | 99 | !next i |
100 | |||
101 | !if $ac_su_class=yes |
||
12981 | bpr | 102 | ac_su_list2=!defof user_supervise in $userdir/$sup_save |
103 | ac_su_list=!listunion $ac_su_list and $ac_su_list2 |
||
104 | !setdef !set user_supervise=$ac_su_list in $userdir/$sup_save |
||
20 | reyssat | 105 | !endif |