Rev 12981 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | # Delete a course. |
2 | # Calling parameter: course address. |
||
3 | |||
4 | thiscourse=!translate internal / to , in $wims_read_parm |
||
5 | thislevel=$(thiscourse[1]) |
||
6 | |||
7 | !if $wims_superclass=$empty or $thislevel=$empty or $wims_user!=supervisor |
||
8 | !exit |
||
9 | !endif |
||
10 | |||
11 | classdir=wimshome/log/classes/$wims_superclass |
||
12 | cls_=$wims_read_parm |
||
13 | cls__=$classdir/$cls_ |
||
14 | !if $wims_class/ notin $wims_superclass/$wims_read_parm |
||
15 | progtest=!defof sharing_exam in $classdir/ls_/neighbors |
||
16 | !if $wims_class/ notin $progtest/ |
||
17 | !exit |
||
18 | !endif |
||
19 | !endif |
||
20 | test=!defof class_defined in $cls__/.def |
||
21 | !if $test!=yes |
||
22 | error=del_not_exist |
||
23 | !exit |
||
24 | !endif |
||
25 | |||
26 | sharelist=!defof sharing_all in $cls__/neighbors |
||
27 | !for dp_C in $sharelist |
||
28 | !read adm/class/stopshare $dp_C,$wims_superclass/$cls_\ |
||
29 | all |
||
30 | error= |
||
31 | !next dp_C |
||
32 | |||
33 | cls=!translate / to , in $cls_ |
||
34 | cls=!item 1 to -2 of $cls |
||
35 | cls=!translate , to / in $cls |
||
36 | cls=!nospace $cls |
||
37 | ocourses=!defof class_ocourses in $classdir/$cls/.def |
||
38 | !if $cls_ isitemof $ocourses |
||
39 | ocourses=!listcomplement $cls_ in $ocourses |
||
40 | !setdef !set class_ocourses=$ocourses in $classdir/$cls/.def |
||
41 | !else |
||
42 | n=!recordcnt $classdir/$cls_/.userlist |
||
43 | !for i=1 to $n |
||
44 | l=!record $i of $classdir/$cls_/.userlist |
||
45 | u=!item 3 of $l |
||
46 | s=!defof user_class in $classdir/$cls_/.users/$u |
||
47 | !if $s!=$empty |
||
48 | l=!defof user_courses in $classdir/$s/.users/$u |
||
49 | !if $cls_ isitemof $l |
||
50 | l=!listcomplement $cls_ in $l |
||
51 | !setdef !set user_courses=$l in $classdir/$s/.users/$u |
||
52 | !endif |
||
53 | !endif |
||
54 | !next i |
||
55 | !endif |
||
56 | |||
57 | !read adm/gateway/delsup $cls_ |
||
58 | !sh cd $wims_home/log/classes/$wims_superclass\ |
||
59 | rm -Rf $cls_ |
||
60 |