Rev 12895 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | reyssat | 1 | !! Stop sharing between two classes. |
2 | !! Calling parameters: 2 lines. |
||
3 | !! Line 1: initiating class, destination class |
||
4 | !! Line 2: list of resources to share. |
||
5 | |||
6 | as_1=!translate internal , to $ $ in $wims_read_parm |
||
7 | !distribute lines $as_1 into as_1,as_l |
||
8 | !distribute words $as_1 into as_1,as_2 |
||
9 | as_l=!words2items $as_l |
||
10 | |||
11 | as_t_exo=src def Exindex Extitles |
||
12 | as_t_sheet=sheets |
||
13 | as_t_exam=exams |
||
14 | as_t_vote=vote |
||
15 | as_t_doc=doc |
||
16 | as_t_forum=forum |
||
5392 | bpr | 17 | as_t_user=.users .userlist .userlist_external |
20 | reyssat | 18 | as_t_motd=.motd |
19 | as_t_sup=supervisor |
||
810 | guerimand | 20 | as_t_cdt=cdt |
1322 | guerimand | 21 | as_t_livret=livret |
17043 | bpr | 22 | as_t_seq=seq |
12115 | guerimand | 23 | as_t_userphoto=photoboard |
12895 | guerimand | 24 | as_t_tool=tool |
25 | as_list=exo,sheet,exam,vote,doc,forum,user,motd,sup,cdt,livret,seq,userphoto,tool |
||
17043 | bpr | 26 | !!to fix if the list is changed .... |
27 | !for tmp in $as_list |
||
28 | !default as_t_$tmp=$tmp |
||
29 | !endif |
||
20 | reyssat | 30 | !if sharing notwordof $wims_prefix |
12555 | bpr | 31 | wims_prefix=$wims_prefix n sharing sharable |
20 | reyssat | 32 | !endif |
33 | |||
34 | !if all isitemof $as_l |
||
12555 | bpr | 35 | as_l=$as_list |
20 | reyssat | 36 | !else |
12555 | bpr | 37 | !if exo isitemof $as_l |
38 | as_l=!listunion $as_l and sheet |
||
39 | !endif |
||
40 | !if sheet iswordof $as_l |
||
41 | as_l=!listunion $as_l and exam |
||
42 | !endif |
||
20 | reyssat | 43 | !endif |
44 | |||
45 | 1_=!translate internal / to , in $as_1 |
||
46 | 2_=!translate internal / to , in $as_2 |
||
47 | 1=!itemcnt $1_ |
||
48 | 2=!itemcnt $2_ |
||
49 | 3=$[min($1,$2)] |
||
50 | |||
51 | !for i=1 to $3+1 |
||
12555 | bpr | 52 | !if $(1_[$i]) != $(2_[$i]) |
53 | !break |
||
54 | !endif |
||
20 | reyssat | 55 | !next i |
56 | |||
57 | 1_=!item $i to -1 of $1_ |
||
58 | !if $i<=$2 |
||
12555 | bpr | 59 | 4_=!makelist .. for x=$i to $2 |
60 | 1_=$4_,$1_ |
||
20 | reyssat | 61 | !endif |
62 | 1_=!nonempty items $1_ |
||
63 | 1_=!nospace $1_ |
||
64 | 1_=!translate internal , to / in $1_ |
||
65 | |||
66 | !for t in $as_list |
||
12555 | bpr | 67 | !reset sharing_$t |
20 | reyssat | 68 | !next t |
69 | !readdef wimshome/log/classes/$as_2/neighbors |
||
70 | as_l1= |
||
71 | !for t in $as_l |
||
12555 | bpr | 72 | !if $(sharing_$t) = $as_1 |
73 | as_l1=!append item $t to $as_l1 |
||
74 | !endif |
||
20 | reyssat | 75 | !next t |
76 | as_l=$as_l1 |
||
77 | !if $as_l=$empty |
||
12555 | bpr | 78 | error=stopshare_notsharing |
79 | !exit |
||
20 | reyssat | 80 | !endif |
81 | |||
82 | L_= |
||
83 | !for t in $as_list |
||
12555 | bpr | 84 | !if $t isitemof $as_l |
85 | L_=$L_ $(as_t_$t) |
||
86 | !endif |
||
20 | reyssat | 87 | !next t |
88 | !if $L_=$empty |
||
12555 | bpr | 89 | !exit |
20 | reyssat | 90 | !endif |
91 | |||
92 | !goto skip_sharable |
||
93 | !for t in $as_list |
||
12555 | bpr | 94 | !reset sharable_$t |
20 | reyssat | 95 | !next t |
96 | !readdef wimshome/log/classes/$as_1/neighbors |
||
97 | as_= |
||
98 | !for t in $as_l |
||
12555 | bpr | 99 | sharable_$t=!listcomplement $as_2 in $(sharable_$t) |
100 | as_=$as_\ |
||
20 | reyssat | 101 | sharable_$t=$(sharable_$t) |
102 | !next t |
||
103 | as_all= |
||
104 | !for t in $as_list |
||
12555 | bpr | 105 | as_all=$as_all,$(sharing_$t) |
20 | reyssat | 106 | !next t |
107 | !if $as_2 notitemof $as_all |
||
12555 | bpr | 108 | sharable_all=!listcomplement $as_2 in $sharable_all |
109 | as_=$as_\ |
||
20 | reyssat | 110 | sharable_all=$sharable_all |
111 | !endif |
||
112 | !setdef $as_ in wimshome/log/classes/$as_1/neighbors |
||
113 | :skip_sharable |
||
114 | |||
115 | !for t in $as_list |
||
12555 | bpr | 116 | !reset sharing_$t |
20 | reyssat | 117 | !next t |
118 | !readdef wimshome/log/classes/$as_2/neighbors |
||
119 | as_= |
||
120 | !for t in $as_l |
||
12555 | bpr | 121 | sharing_$t= |
122 | as_=$as_\ |
||
20 | reyssat | 123 | sharing_$t= |
124 | !next t |
||
125 | as_all= |
||
126 | !for t in $as_list |
||
12555 | bpr | 127 | as_all=$as_all,$(sharing_$t) |
20 | reyssat | 128 | !next t |
129 | !if $as_1 notitemof $as_all |
||
12555 | bpr | 130 | sharing_all=!listcomplement $as_1 in $sharing_all |
131 | as_=$as_\ |
||
20 | reyssat | 132 | sharing_all=$sharing_all |
133 | !endif |
||
134 | !setdef $as_ in wimshome/log/classes/$as_2/neighbors |
||
135 | |||
136 | !sh cd $wims_home/log/classes/$as_2\ |
||
137 | rm -Rf $L_\ |
||
138 | for f in $L_; do\ |
||
139 | cp -R $1_/$$f . 2>/dev/null\ |
||
140 | done |