Subversion Repositories wimsdev

Rev

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