File: import2.proc

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (240 lines) | stat: -rw-r--r-- 6,478 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
!if ($wims_class notitemof $nei_sup,$nei_part or\
	$nei notitemof $n_sup,$n_part) and \
    all notitemof $nei_sup,$nei_part
  error=not_neighbor
  job2=first
  !exit
!endif

!read scripts/reccnt.proc me log/classes/$wims_class
!read scripts/reccnt.proc it log/classes/$nei
import=!trim $import
!if $import=$empty
  :noimp
  job2=import
  !changeto neighbor/import.proc
!endif

!bound impmethod within add,replace default add
!distribute items $import into itype,iname
imported=1
!if $itype notitemof motd,exo,sheet,exam,doc,user,livret,glossary,pdoc,tool
  !goto noimp
!endif

!if ($wims_class notitemof $nei_sup or $nei notitemof $n_sup) and \
    all notitemof $nei_sup
  !if $itype!=user
    !goto noimp
  !endif
!endif

!if $itype=livret
  !if $confirm!=yes and $impmethod=replace
    test=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$replace
    !if $test>0
      result=confirm
      cfm=$cfm replace
      !exit
    !endif
  !endif
  nbnei=!recordcnt wimshome/log/classes/$nei/livret/.comps
  !if $impmethod=replace
    !sh rm -f $wims_home/log/classes/$wims_class/livret/.comp[0-9]*;\
rm -f $wims_home/log/classes/$wims_class/livret/.comps
  !endif
  !sh cp $wims_home/log/classes/$nei/livret/.comps $wims_home/log/classes/$wims_class/livret/.comps
  nb=!recordcnt wimshome/log/classes/$nei/livret/.comps
  !for k=1 to $nb
    comp=$empty
    nbp=!recordcnt wimshome/log/classes/$nei/livret/.comp$k
    !for l=1 to $nbp
      d=!record $l of wimshome/log/classes/$nei/livret/.comp$k
      d=!line 1 of $d
      comp=!append line :$d\
    to $comp
    !next l
    !writefile wimshome/log/classes/$wims_class/livret/.comp$[$k] $comp
  !next k
  verif=module=adm/class/livret
  !exit
!endif

!distribute line doc/.docindex\
tool/.toolindex into file_pdoc,file_tool
!if $itype=pdoc or $itype=tool
  !if $confirm!=yes and $impmethod=replace
    test=!recordcnt wimshome/log/classes/$wims_class/$(file_$itype)
    !if $test>0
      result=confirm
      cfm=$cfm replace
      !exit
    !endif
  !endif
  nbnei=!recordcnt wimshome/log/classes/$nei/$(file_$itype)
  !if $impmethod=replace
    !sh rm -f $wims_home/log/classes/$wims_class/$(file_$itype)
  !endif
  !sh cp $wims_home/log/classes/$nei/$(file_$itype) $wims_home/log/classes/$wims_class/$(file_$itype)
  verif=module=home
  !exit
!endif

!if $itype=motd
  result=!mexec neighbor/import2.sh
  verif=module=adm/class/motd
  !exit
!endif

!if $itype=exo
  result=!mexec neighbor/import2.sh
  verif=module=classes/$lang
  !exit
!endif

!if $itype=sheet
  !if $confirm!=yes
    !if $it_exocnt>0
      result=confirm
      cfm=$cfm dep
      !exit
    !endif
    !if $impmethod=replace
      test=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$replace
      !if $test>0
        result=confirm
        cfm=$cfm replace
        !exit
      !endif
    !endif
  !endif
  header=!record $iname of wimshome/log/classes/$nei/sheets/.sheets
  header=!line 2 to -1 of $header
  header=!replace line number 1 by $class_expiration in $header
  !! --- delete reference to a doc for sheet presentation
  tmp=!line 4 of $header
  !if $tmp notitemof yes,no,$empty
    header=!replace line number 4 by $empty in $header
  !endif
  !! --- delete reference to a technical variable to hide sheet
  header=!replace line number 8 by $empty in $header
  !if $impmethod=add
    !appendfile wimshome/log/classes/$wims_class/sheets/.sheets :0\
$header
    replace=$[$me_sheetcnt+1]
  !endif
  result=!mexec neighbor/import2.sh
  verif=module=adm/class/sheet&sheet=$replace
  !exit
!endif

!if $itype=exam
  !if $confirm!=yes
    result=confirm
    cfm=$cfm dep
    !if $impmethod=replace
      test=!recordcnt wimshome/log/classes/$wims_class/exams/.exam$replace
      !if $test>0
        result=confirm
        cfm=$cfm replace
        !exit
      !endif
    !endif
    !exit
  !endif
  header=!record $iname of wimshome/log/classes/$nei/exams/.exams
  header=!line 2 to -1 of $header
  !if $impmethod=add
    !appendfile wimshome/log/classes/$wims_class/exams/.exams :0\
$header
    replace=$[$me_examcnt+1]
  !endif
  result=!mexec neighbor/import2.sh
  verif=module=adm/class/exam&exam=$replace
  !exit
!endif

!if $itype=glossary
  !if $confirm!=yes
    result=confirm
    cfm=$cfm dep
    !if $impmethod=replace
      test=!recordcnt wimshome/log/classes/$wims_class/tool/.glossary$replace
      !if $test>0
        result=confirm
        cfm=$cfm replace
        !exit
      !endif
    !endif
    !exit
  !endif
  header=!record $iname of wimshome/log/classes/$nei/tool/.glossaryindex
  header=!line 2 to -1 of $header
  !if $impmethod=add
    !appendfile wimshome/log/classes/$wims_class/tool/.glossaryindex :0\
$header
    replace=$[$me_examcnt+1]
  !endif
  result=!mexec neighbor/import2.sh
  verif=module=adm/tool/glossary&gl=$replace
  !exit
!endif

!if $itype=doc
  !if $confirm!=yes
    !if $impmethod=replace
      result=confirm
      cfm=$cfm replace
      !exit
    !endif
  !endif
  !if $impmethod=add
    replace=$[$me_doccnt+1]
  !endif
  result=!mexec neighbor/import2.sh
  Docdir=log/classes/$wims_class/doc
  docdir=wimshome/$Docdir
  !read adm/docindex.proc
  verif=module=adm/doc&job=read&doc=c$replace
  !exit
!endif

!if $itype=user
  imported=
  !read adm/class/userremain.proc
  !for i=1 to $it_usercnt
    t=!record $i of wimshome/log/classes/$nei/.userlist
    u=!item 3 of $t
    !if $u isitemof $iname or $iname=-all-
      test1=!defof user_exists in wimshome/log/classes/$wims_class/.users/$u
      !default test1=!defof user_exists in wimshome/log/classes/$wims_class/.users/.$u
      !if $test1=$empty
        !if $dispo>0
          ud=!record 0 of wimshome/log/classes/$nei/.users/$u
          !writefile wimshome/log/classes/$wims_class/.users/$u $ud
          !! userphoto copy
          cls=!defof class_superclass in wimshome/log/classes/$nei/.def
          !if $cls=$empty
            photodir=$nei
          !else
            photodir=$cls
          !endif
          !sh mkdir -p $wims_home/log/classes/$wims_class/photoboard/; \
cp $wims_home/log/classes/$photodir/photoboard/$u $wims_home/log/classes/$wims_class/photoboard/$u
          !! end userphoto copy
          imported=!append item $u to $imported
        !endif
      !endif
    !endif
  !next i
  !if $imported!=$empty
    !read adm/class/mkuserlist
    !read adm/class/stat
    result=success
    importedcnt=!itemcnt $imported
  !else
    result=none
  !endif
  verif=module=adm/class/usermanage
  !exit
!endif