Subversion Repositories wimsdev

Rev

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