Subversion Repositories wimsdev

Rev

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