Subversion Repositories wimsdev

Rev

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