Rev 12981 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | # Delete a class and all its courses. |
2 | # Calling parameter: class address. |
||
3 | |||
4 | thisclass=!translate internal / to , in $wims_read_parm |
||
5 | thislevel=$(thisclass[1]) |
||
6 | |||
7 | !if $wims_superclass=$empty or $thislevel=$empty or $wims_user!=supervisor |
||
12981 | bpr | 8 | !exit |
20 | reyssat | 9 | !endif |
10 | |||
11 | cls_=$wims_read_parm |
||
12 | classdir=wimshome/log/classes/$wims_superclass |
||
13 | cls__=$classdir/$cls_ |
||
14 | !if $cls_= or $wims_class/ notin $wims_superclass/$cls_ |
||
12981 | bpr | 15 | !exit |
20 | reyssat | 16 | !endif |
17 | test=!defof class_defined in $cls__/.def |
||
18 | !if $test!=yes |
||
12981 | bpr | 19 | error=del_not_exist |
20 | !exit |
||
20 | reyssat | 21 | !endif |
22 | |||
23 | courses=!record 0 of $cls__/courses |
||
24 | courses=!column 1 of $courses |
||
25 | courses=!nonempty items $courses |
||
26 | |||
27 | class_=$wims_superclass/$cls_ |
||
28 | !for dp_c in $courses |
||
29 | sharelist=!defof sharing_all in $classdir/$dp_c/neighbors |
||
30 | !for dp_C in $sharelist |
||
12981 | bpr | 31 | !if $dp_C != $class_ |
32 | !read adm/class/stopshare $dp_C,$wims_superclass/$dp_c\ |
||
14336 | bpr | 33 | all |
12981 | bpr | 34 | !endif |
35 | !next dp_C |
||
36 | error= |
||
37 | !read adm/gateway/delsup $dp_c |
||
20 | reyssat | 38 | !next dp_c |
39 | |||
40 | n=!recordcnt $classdir/$cls_/.userlist |
||
41 | !for i=1 to $n |
||
12981 | bpr | 42 | l=!record $i of $classdir/$cls_/.userlist |
43 | u=!item 3 of $l |
||
44 | s=!defof user_participate in $classdir/.users/$u |
||
45 | !if $class_ isitemof $s |
||
46 | s=!listcomplement $class_ in $s |
||
47 | !setdef !set user_participate=$s in $classdir/.users/$u |
||
48 | !endif |
||
20 | reyssat | 49 | !next i |
50 | |||
51 | !read adm/gateway/delsup $cls_ |
||
52 | |||
53 | courses=!items2words $courses |
||
54 | !sh cd $wims_home/log/classes/$wims_superclass\ |
||
55 | rm -Rf $cls_ $courses |