Subversion Repositories wimsdev

Rev

Rev 1407 | Rev 12115 | Go to most recent revision | 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
1407 bpr 22
as_list=exo,sheet,exam,vote,doc,forum,user,motd,sup,cdt,livret,seq
20 reyssat 23
!if sharing notwordof $wims_prefix
24
 wims_prefix=$wims_prefix n sharing sharable
25
!endif
26
 
27
!if all isitemof $as_l
28
 as_l=$as_list
29
!else
30
 !if exo isitemof $as_l
31
  as_l=!listunion $as_l and sheet
32
 !endif
33
 !if sheet iswordof $as_l
34
  as_l=!listunion $as_l and exam
35
 !endif
36
!endif
37
 
38
1_=!translate internal / to , in $as_1
39
2_=!translate internal / to , in $as_2
40
1=!itemcnt $1_
41
2=!itemcnt $2_
42
3=$[min($1,$2)]
43
 
44
!for i=1 to $3+1
45
 !if $(1_[$i]) != $(2_[$i])
46
  !break
47
 !endif
48
!next i
49
 
50
1_=!item $i to -1 of $1_
51
!if $i<=$2
52
 4_=!makelist .. for x=$i to $2
53
 1_=$4_,$1_
54
!endif
55
1_=!nonempty items $1_
56
1_=!nospace $1_
57
1_=!translate internal , to / in $1_
58
 
59
!for t in $as_list
60
 !reset sharing_$t
61
!next t
62
!readdef wimshome/log/classes/$as_2/neighbors
63
as_l1=
64
!for t in $as_l
65
 !if $(sharing_$t) = $as_1
66
  as_l1=!append item $t to $as_l1
67
 !endif
68
!next t
69
as_l=$as_l1
70
!if $as_l=$empty
71
 error=stopshare_notsharing
72
 !exit
73
!endif
74
 
75
L_=
76
!for t in $as_list
77
 !if $t isitemof $as_l
78
  L_=$L_ $(as_t_$t)
79
 !endif
80
!next t
81
!if $L_=$empty
82
 !exit
83
!endif
84
 
85
!goto skip_sharable
86
!for t in $as_list
87
 !reset sharable_$t
88
!next t
89
!readdef wimshome/log/classes/$as_1/neighbors
90
as_=
91
!for t in $as_l
92
 sharable_$t=!listcomplement $as_2 in $(sharable_$t)
93
 as_=$as_\
94
sharable_$t=$(sharable_$t)
95
!next t
96
as_all=
97
!for t in $as_list
98
 as_all=$as_all,$(sharing_$t)
99
!next t
100
!if $as_2 notitemof $as_all
101
 sharable_all=!listcomplement $as_2 in $sharable_all
102
 as_=$as_\
103
sharable_all=$sharable_all
104
!endif
105
!setdef $as_ in wimshome/log/classes/$as_1/neighbors
106
:skip_sharable
107
 
108
!for t in $as_list
109
 !reset sharing_$t
110
!next t
111
!readdef wimshome/log/classes/$as_2/neighbors
112
as_=
113
!for t in $as_l
114
 sharing_$t=
115
 as_=$as_\
116
sharing_$t=
117
!next t
118
as_all=
119
!for t in $as_list
120
 as_all=$as_all,$(sharing_$t)
121
!next t
122
!if $as_1 notitemof $as_all
123
 sharing_all=!listcomplement $as_1 in $sharing_all
124
 as_=$as_\
125
sharing_all=$sharing_all
126
!endif
127
!setdef $as_ in wimshome/log/classes/$as_2/neighbors
128
 
129
!sh cd $wims_home/log/classes/$as_2\
130
 rm -Rf $L_\
131
 for f in $L_; do\
132
  cp -R $1_/$$f . 2>/dev/null\
133
 done
134