Subversion Repositories wimsdev

Rev

Rev 10355 | Rev 13627 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10355 Rev 13581
Line 19... Line 19...
19
choicelim=!defof MAX_OEFCHOICES in wimshome/public_html/bases/sys/define.conf
19
choicelim=!defof MAX_OEFCHOICES in wimshome/public_html/bases/sys/define.conf
20
!distribute item 10,40 into condlim,promptlim
20
!distribute item 10,40 into condlim,promptlim
21
!bound mode within raw,file,model default $
21
!bound mode within raw,file,model default $
22
!read tabletheme
22
!read tabletheme
23
!if $wims_user!=$empty or $wims_developer!=$empty
23
!if $wims_user!=$empty or $wims_developer!=$empty
24
 !default oef_author=!trim $wims_firstname $wims_lastname
24
  !default oef_author=!trim $wims_firstname $wims_lastname
25
 !default oef_email=$wims_email
25
  !default oef_email=$wims_email
26
 !if $wims_developer!=$empty
26
  !if $wims_developer!=$empty
27
  !read adm/getdeveloper
27
    !read adm/getdeveloper
28
  !default oef_author=$dv_name
28
    !default oef_author=$dv_name
29
  !default oef_email=$dv_email
29
    !default oef_email=$dv_email
30
 !endif
30
  !endif
31
 !if $newone=1
31
  !if $newone=1
32
  existing=
32
    existing=
33
  newone=
33
    newone=
34
 !endif
34
  !endif
35
 !if (..devel/ notin ..$catmodule or $wims_developer=$empty) and \
35
  !if (..devel/ notin ..$catmodule or $wims_developer=$empty) and \
36
	$existing!=$empty and $wims_user!=supervisor \
36
 	    $existing!=$empty and $wims_user!=supervisor \
37
	and ..*/$wims_user. notin ..*/$existing
37
 	    and ..*/$wims_user. notin ..*/$existing
38
  existing=
38
    existing=
39
 !endif
39
  !endif
40
 !if $existing!=$empty and $level=$empty
40
  !if $existing!=$empty and $level=$empty
41
  !if $catmodule!=$empty
41
    !if $catmodule!=$empty
42
   !if ..devel/ isin ..$catmodule and ($wims_developer= or \
42
      !if ..devel/ isin ..$catmodule and ($wims_developer= or \
43
	..devel/$wims_developer notin ..$catmodule)
43
	      ..devel/$wims_developer notin ..$catmodule)
44
    !goto nonexist
44
        !goto nonexist
45
   !endif
45
      !endif
46
   !if .. isin $catmodule or ..adm/ isin ..$catmodule or \
46
    !if .. isin $catmodule or ..adm/ isin ..$catmodule or \
47
	..classes/ isin ..$catmodule
47
	      ..classes/ isin ..$catmodule
48
    !goto nonexist
48
      !goto nonexist
49
   !endif
49
    !endif
50
  !endif
50
  !endif
51
  src=!mexec catexisting.sh $existing
51
  src=!mexec catexisting.sh $existing
52
  !if $src!=$empty
52
  !if $src!=$empty
53
   mode=raw
53
    mode=raw
54
   level=1
54
    level=1
55
  !else
55
  !else
56
   :nonexist
56
    :nonexist
57
   error=not_exist
57
    error=not_exist
58
   del=$existing
58
    del=$existing
59
   existing=
59
    existing=
60
   !exit
60
    !exit
-
 
61
    !endif
61
  !endif
62
  !endif
62
 !endif
-
 
63
!else
63
!else
64
 existing=
64
  existing=
65
!endif
65
!endif
66
 
66
 
67
!if $cmd=help
67
!if $cmd=help
68
 !if $realtest=yes
68
  !if $realtest=yes
69
!!variable for ariane
69
    !!variable for ariane
70
   !set ariane_title=$$wims_name_createxo
70
    !set ariane_title=$$wims_name_createxo
71
   !set wims_ariane=!append line backcreatexo,1,module=adm/createxo&cmd=resume&realtest=no\
71
    !set wims_ariane=!append line backcreatexo,1,module=adm/createxo&cmd=resume&realtest=no\
72
testexo,1,module=$module&cmd=resume\
72
testexo,1,module=$module&cmd=resume\
73
to $wims_ariane
73
to $wims_ariane
74
   !changeto oef/var.proc
74
    !changeto oef/var.proc
75
 !else
75
 !else
76
   !set wims_ariane=!append line resume,1,module=$module&cmd=resume\
76
    !set wims_ariane=!append line resume,1,module=$module&cmd=resume\
77
to $wims_ariane
77
to $wims_ariane
78
   !if $modtoolhelp!=yes
78
    !if $modtoolhelp!=yes
79
!!trouble with mhelp=%2Cmhelp (coming from ,mhelp)
79
      !!trouble with mhelp=%2Cmhelp (coming from ,mhelp)
80
     !if $special_parm!=$empty and ($special_parm notwordof mhelp help and mhelp notin $special_parm)
80
      !if $special_parm!=$empty and ($special_parm notwordof mhelp help and mhelp notin $special_parm)
81
      !set wims_ariane=!append line back2 $$wims_name_help,1,cmd=help\
81
        !set wims_ariane=!append line back2 $$wims_name_help,1,cmd=help\
82
 to $wims_ariane
82
 to $wims_ariane
83
     !endif
83
      !endif
84
   !endif
84
    !endif
85
 !endif
85
  !endif
86
 !if $modtoolhelp=yes
86
  !if $modtoolhelp=yes
87
    !distribute items no,no, into wims_ariane_home,wims_ariane_self,wims_ariane
87
    !distribute items no,no, into wims_ariane_home,wims_ariane_self,wims_ariane
88
 !endif
88
  !endif
89
 !exit
89
  !exit
90
!endif
90
!endif
91
!if $modtoolhelp=yes
91
!if $modtoolhelp=yes
92
  !distribute items no,no, into wims_ariane_home,wims_ariane_self,wims_ariane
92
  !distribute items no,no, into wims_ariane_home,wims_ariane_self,wims_ariane
93
!endif
93
!endif
94
!if $delete!=$empty
94
!if $delete!=$empty
95
 !if $wims_class==$empty
95
  !if $wims_class==$empty
96
  error=not_class
96
    error=not_class
-
 
97
    !exit
-
 
98
  !endif
-
 
99
  !if $wims_user!=supervisor
-
 
100
    error=not_supervisor
-
 
101
    !exit
-
 
102
  !endif
-
 
103
  del=!word 1 of $delete
-
 
104
  delete=
-
 
105
  deleted=!mexec delexo.sh $del
-
 
106
  !if $deleted=$empty
-
 
107
    error=not_exist
-
 
108
  !else
-
 
109
    wims_module_log=delete $wims_class/$del
-
 
110
  !endif
97
  !exit
111
  !exit
98
 !endif
-
 
99
 !if $wims_user!=supervisor
-
 
100
  error=not_supervisor
-
 
101
  !exit
-
 
102
 !endif
-
 
103
 del=!word 1 of $delete
-
 
104
 delete=
-
 
105
 deleted=!mexec delexo.sh $del
-
 
106
 !if $deleted=$empty
-
 
107
  error=not_exist
-
 
108
 !else
-
 
109
  wims_module_log=delete $wims_class/$del
-
 
110
 !endif
-
 
111
 !exit
-
 
112
!endif
112
!endif
113
 
113
 
114
!if $level notwordof 2 and ($realtest!=no and $realtest!=$empty)
114
!if $level notwordof 2 and ($realtest!=no and $realtest!=$empty)
115
  !set wims_ariane=!append line backcreatexo,1,cmd=resume&realtest=no\
115
  !set wims_ariane=!append line backcreatexo,1,cmd=resume&realtest=no\
116
  to $wims_ariane
116
  to $wims_ariane
Line 118... Line 118...
118
!if $level iswordof 6
118
!if $level iswordof 6
119
  !set wims_ariane=!append line backcreatexo,1,cmd=reply&level=3\
119
  !set wims_ariane=!append line backcreatexo,1,cmd=reply&level=3\
120
  to $wims_ariane
120
  to $wims_ariane
121
!endif
121
!endif
122
!if $mode=model and $model!=$empty
122
!if $mode=model and $model!=$empty
123
 model=!text select abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 in $model
123
  model=!text select abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 in $model
124
 !sh cp -f $wims_home/public_html/scripts/model/$lang/src/$model.oef $wims_home/sessions/$wims_session/user-deposit\
124
  !sh cp -f $wims_home/public_html/scripts/model/$lang/src/$model.oef $wims_home/sessions/$wims_session/user-deposit\
125
   cp -f $wims_home/sessions/$wims_session/user-deposit $wims_home/sessions/$wims_session/submit.oef
125
    cp -f $wims_home/sessions/$wims_session/user-deposit $wims_home/sessions/$wims_session/submit.oef
126
 !if $level=3 and $realtest=yes
126
  !if $level=3 and $realtest=yes
127
  !mexec makedef.sh
127
    !mexec makedef.sh
128
 !endif
128
  !endif
129
 !reset status
129
  !reset status
130
 model=
130
  model=
131
!endif
131
!endif
132
 
132
 
133
!if $level=2 and $mode=model
133
!if $level=2 and $mode=model
134
 !read model/cut.proc
134
  !read model/cut.proc
135
 !if $cnt<6 or $sps=$empty or $parms=$empty or $desc=$empty or\
135
  !if $cnt<6 or $sps=$empty or $parms=$empty or $desc=$empty or\
136
	$model_type=$empty or statementrec=$empty
136
 	    $model_type=$empty or statementrec=$empty
137
  mode=
137
    mode=
138
  !goto nomodel
138
    !goto nomodel
139
 !endif
139
  !endif
140
 !set wims_ariane=!append line modellist,1,cmd=reply&level=1&mode=model\
140
  !set wims_ariane=!append line modellist,1,cmd=reply&level=1&mode=model\
141
to $wims_ariane
141
to $wims_ariane
142
!endif
142
!endif
143
 
143
 
144
!if $level=2 and $mode=$empty
144
!if $level=2 and $mode=$empty
145
  !set wims_ariane=!append line normalmode,1,cmd=reply&level=1\
145
  !set wims_ariane=!append line normalmode,1,cmd=reply&level=1\
146
to $wims_ariane
146
to $wims_ariane
147
 !read model/cut.proc
147
  !read model/cut.proc
148
 !if $cnt>=6 and $sps!=$empty and $parms!=$empty and $desc!=$empty and\
148
  !if $cnt>=6 and $sps!=$empty and $parms!=$empty and $desc!=$empty and\
149
	$model_type!=$empty and statementrec>1
149
	    $model_type!=$empty and statementrec>1
150
  mode=model
150
    mode=model
151
  rawinp=
151
    rawinp=
152
 !endif
152
  !endif
153
!endif
153
!endif
154
 
154
 
155
:nomodel
155
:nomodel
156
!if $level=3 and $realtest=yes
156
!if $level=3 and $realtest=yes
157
  oef_test=yes
157
    oef_test=yes
158
 !changeto oef/var.proc
158
  !changeto oef/var.proc
159
!else
159
!else
160
 !if $realtest=no
160
 !if $realtest=no
161
  question=
161
    question=
162
  hint=
162
    hint=
163
  solution=
163
    solution=
164
  status=
164
    status=
165
  varcnt=0
165
    varcnt=0
166
  replycnt=0
166
    replycnt=0
167
  choicecnt=0
167
    choicecnt=0
168
  score=
168
    score=
169
  !if $mode=model
169
    !if $mode=model
170
   !for i=1 to 100
170
      !for i=1 to 100
171
    reply$i=
171
        reply$i=
172
   !next i
172
      !next i
173
  !endif model
173
    !endif model
174
 !endif realtest
174
  !endif realtest
175
 !reset status realtest retest
175
  !reset status realtest retest
176
!endif level=3
176
!endif level=3
177
 
177
 
178
!if $rawinp!=$empty
178
!if $rawinp!=$empty
179
 mode=raw
179
  mode=raw
180
 level=1
180
  level=1
181
 rawinp=
181
  rawinp=
182
!endif
182
!endif
183
 
183
 
184
!if $mode=raw and $level<=2
184
!if $mode=raw and $level<=2
185
 modeltest=!recordcnt wimshome/sessions/$wims_session/submit.oef
185
  modeltest=!recordcnt wimshome/sessions/$wims_session/submit.oef
186
 !if $modeltest>6
186
  !if $modeltest>6
187
  modeltest=!record 0 of wimshome/sessions/$wims_session/submit.oef
187
    modeltest=!record 0 of wimshome/sessions/$wims_session/submit.oef
188
  modeltest=!getopt type in $modeltest
188
    modeltest=!getopt type in $modeltest
189
  !if $modeltest!=$empty
189
    !if $modeltest!=$empty
190
   modeltest=yes
190
      modeltest=yes
191
   !sh cd $wims_home/sessions/$wims_session\
191
      !sh cd $wims_home/sessions/$wims_session\
192
    [ -s user-deposit ] || cp -f submit.oef user-deposit
192
        [ -s user-deposit ] || cp -f submit.oef user-deposit
-
 
193
    !endif
193
  !endif
194
  !endif
194
 !endif
-
 
195
!endif
195
!endif
196
 
196
 
197
!bound oef_format within tex,html default html
197
!bound oef_format within tex,html default html
198
!bound oef_answercnt between integer 0 and $answerlim default 1
198
!bound oef_answercnt between integer 0 and $answerlim default 1
199
!bound oef_choicecnt between integer 0 and $choicelim default 0
199
!bound oef_choicecnt between integer 0 and $choicelim default 0
200
!bound oef_condcnt   between integer 0 and $condlim   default 0
200
!bound oef_condcnt   between integer 0 and $condlim   default 0
201
!bound oef_precision within 100,1000,10000,100000,1000000 default 10000
201
!bound oef_precision within 100,1000,10000,100000,1000000 default 10000
202
!bound oef_computeanswer within yes,no default no
202
!bound oef_computeanswer within yes,no default no
203
!bound level between integer 0 and 7 default 0
203
!bound level between integer 0 and 7 default 0
204
!if $level=6 and $wims_user!=supervisor
204
!if $level=6 and $wims_user!=supervisor
205
 level=1
205
  level=1
206
!endif
206
!endif
207
 
207
 
208
!for i in l,r
208
!for i in l,r
209
 oef_range$i=!trim $(oef_range$i)
209
  oef_range$i=!trim $(oef_range$i)
210
 !if $(oef_range$i)!=$empty
210
  !if $(oef_range$i)!=$empty
211
  oef_range$i=$[$(oef_range$i)]
211
    oef_range$i=$[$(oef_range$i)]
212
  !if NaN isin $(oef_range$i)] or Inf isin $(oef_range$i)
212
    !if NaN isin $(oef_range$i)] or Inf isin $(oef_range$i)
213
   oef_range$i=
213
      oef_range$i=
-
 
214
    !endif
214
  !endif
215
  !endif
215
 !endif
-
 
216
!next i
216
!next i
217
!default oef_rangel=-5
217
!default oef_rangel=-5
218
!default oef_ranger=5
218
!default oef_ranger=5
219
!if $oef_rangel=$oef_ranger
219
!if $oef_rangel=$oef_ranger
220
 oef_rangel=-5
220
  oef_rangel=-5
221
 oef_ranger=5
221
  oef_ranger=5
222
!endif
222
!endif
223
!if $oef_rangel>$oef_ranger
223
!if $oef_rangel>$oef_ranger
224
 range=$oef_rangel
224
  range=$oef_rangel
225
 oef_rangel=$oef_ranger
225
  oef_rangel=$oef_ranger
226
 oef_ranger=$range
226
  oef_ranger=$range
227
!endif
227
!endif
228
 
228
 
229
!if $level>1 and $mode=$empty
229
!if $level>1 and $mode=$empty
230
 oef_title=!trim $oef_title
230
  oef_title=!trim $oef_title
231
 !if $oef_title=$empty and $level>1
231
  !if $oef_title=$empty and $level>1
232
  error=no_title
232
   error=no_title
233
  !exit
233
   !exit
234
 !endif
234
  !endif
235
# !if $oef_answercnt+$oef_choicecnt<=0
235
  # !if $oef_answercnt+$oef_choicecnt<=0
236
#  error=no_answer
236
  #  error=no_answer
237
#  !exit
237
  #  !exit
238
# !endif
238
  # !endif
239
!endif
239
!endif
240
!if $level=7 and $wims_developer!=$empty
240
!if $level=7 and $wims_developer!=$empty
241
  !reset file_name_src
241
  !reset file_name_src
242
   list_mod=!sh ls $wims_home/public_html/modules/devel/$wims_developer
242
   list_mod=!sh ls $wims_home/public_html/modules/devel/$wims_developer
243
   list_mod=!words2items $list_mod
243
   list_mod=!words2items $list_mod
Line 252... Line 252...
252
     error = $error oefempty
252
     error = $error oefempty
253
   !endif
253
   !endif
254
!endif
254
!endif
255
 
255
 
256
!if $level=3
256
!if $level=3
257
 !if $mode=$empty
257
  !if $mode=$empty
258
  header=\language{$lang}\
258
    header=\language{$lang}\
259
\range{$oef_rangel..$oef_ranger}
259
\range{$oef_rangel..$oef_ranger}
260
  !for i in author,email,computeanswer,format,precision
260
    !for i in author,email,computeanswer,format,precision
261
   oef_$i=!trim $(oef_$i)
261
      oef_$i=!trim $(oef_$i)
262
   !if $(oef_$i)!=$empty
262
      !if $(oef_$i)!=$empty
263
    header=!append line \$i{$(oef_$i)} to $header
263
        header=!append line \$i{$(oef_$i)} to $header
264
   !endif
264
      !endif
265
  !next i
265
    !next i
266
  oef_statement=!trim $oef_statement
266
    oef_statement=!trim $oef_statement
267
  !if $oef_statement=$empty
267
    !if $oef_statement=$empty
268
   error=no_statement
268
      error=no_statement
269
   !exit
269
      !exit
270
  !endif
270
    !endif
271
  answers=
271
    answers=
272
  !for i=1 to $oef_answercnt
272
    !for i=1 to $oef_answercnt
273
   ansprompt$i=!trim $(ansprompt$i)
273
      ansprompt$i=!trim $(ansprompt$i)
274
   prompt=!char 1 to $promptlim of $(ansprompt$i)
274
      prompt=!char 1 to $promptlim of $(ansprompt$i)
275
   ansgood$i=!trim $(ansgood$i)
275
      ansgood$i=!trim $(ansgood$i)
276
   !if $prompt!=$empty and $(ansgood$i)!=$empty
276
      !if $prompt!=$empty and $(ansgood$i)!=$empty
277
    !default anstype$i=default
277
        !default anstype$i=default
278
    answers=!append line \answer{$prompt}{$(ansgood$i)}{type=$(anstype$i)} to $answers
278
        answers=!append line \answer{$prompt}{$(ansgood$i)}{type=$(anstype$i)} to $answers
279
   !endif
279
      !endif
280
  !next i
280
    !next i
281
  replycnt=!linecnt $answers
281
    replycnt=!linecnt $answers
282
  choices=
282
    choices=
283
  !for i=1 to $oef_choicecnt
283
    !for i=1 to $oef_choicecnt
284
   choiprompt$i=!trim $(choiprompt$i)
284
      choiprompt$i=!trim $(choiprompt$i)
285
   prompt=!char 1 to $promptlim of $(choiprompt$i)
285
      prompt=!char 1 to $promptlim of $(choiprompt$i)
286
   choigood$i=!trim $(choigood$i)
286
      choigood$i=!trim $(choigood$i)
287
   choibad$i=!trim $(choibad$i)
287
      choibad$i=!trim $(choibad$i)
288
   !if $prompt!=$empty and $(choigood$i)!=$empty and $(choibad$i)!=$empty
288
      !if $prompt!=$empty and $(choigood$i)!=$empty and $(choibad$i)!=$empty
289
    choices=!append line \choice{$prompt}{$(choigood$i)}{$(choibad$i)} to $choices
289
        choices=!append line \choice{$prompt}{$(choigood$i)}{$(choibad$i)} to $choices
290
   !endif
290
      !endif
291
  !next i
291
    !next i
292
  choicecnt=!linecnt $choices
292
    choicecnt=!linecnt $choices
293
  conditions=
293
    conditions=
294
  !for i=1 to $oef_condcnt
294
    !for i=1 to $oef_condcnt
295
   cn=!trim $(Condname$i)
295
      cn=!trim $(Condname$i)
296
   ct=!trim $(Condtest$i)
296
      ct=!trim $(Condtest$i)
297
   !if $cn!=$empty and $ct!=$empty
297
      !if $cn!=$empty and $ct!=$empty
298
    conditions=!append line \condition{$cn}{$ct} to $conditions
298
        conditions=!append line \condition{$cn}{$ct} to $conditions
299
   !endif
299
      !endif
300
  !next i
300
    !next i
301
#  !ifval $replycnt+$choicecnt=0
301
    #  !ifval $replycnt+$choicecnt=0
302
#   error=no_reply2
302
    #   error=no_reply2
303
#   !exit
303
    #   !exit
304
#  !endif
304
    #  !endif
305
  oef_hint=!trim $oef_hint
305
    oef_hint=!trim $oef_hint
306
  !if $oef_hint!=$empty
306
    !if $oef_hint!=$empty
307
   hints=\hint{$oef_hint}
307
      hints=\hint{$oef_hint}
-
 
308
    !endif
-
 
309
    oef_solution=!trim $oef_solution
-
 
310
    !if $oef_solution!=$empty
-
 
311
      solutions=\solution{$oef_solution}
-
 
312
    !endif
-
 
313
    source=!mexec makedef.sh
-
 
314
  !else
-
 
315
    !if $mode=model
-
 
316
      !read model/cutback.proc
-
 
317
    !endif
-
 
318
    !mexec makedef.sh
-
 
319
  !endif mode=$empty
-
 
320
  status=waiting
-
 
321
  oef2wims_out=!record 0 of wimshome/$wims_sesdir/oef2wims.out
-
 
322
  !if ERROR iswordof $oef2wims_out
-
 
323
    :diagerror
-
 
324
    test=!line 1 of $oef2wims_out
-
 
325
    !if ERROR notin $test
-
 
326
      oef2wims_out=!line 2 to -1 of $oef2wims_out
-
 
327
    !endif
-
 
328
    error=def_fail
-
 
329
    !exit
-
 
330
  !endif
-
 
331
  replycnt=
-
 
332
  choicecnt=
-
 
333
  varcnt=
-
 
334
  !read wimshome/$wims_sesdir/submit.def
-
 
335
  !if $replycnt=$empty or $choicecnt=$empty or $varcnt=$empty
-
 
336
    !goto diagerror
-
 
337
    !exit
308
  !endif
338
  !endif
309
  oef_solution=!trim $oef_solution
339
  title=!trim $title
310
  !if $oef_solution!=$empty
340
  !if $title=$empty
311
   solutions=\solution{$oef_solution}
341
    error=empty_title
-
 
342
    !exit
312
  !endif
343
  !endif
-
 
344
  oef_fname=
313
  source=!mexec makedef.sh
345
  titlen=!charcnt $title
-
 
346
  !for i=1 to $titlen
-
 
347
    c=!char $i of $title
-
 
348
    !if $c isin 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_
-
 
349
      oef_fname=$oef_fname$c
314
 !else
350
    !endif
315
  !if $mode=model
351
  !next i
-
 
352
  oef_fname=!char 1 to 14 of $oef_fname
-
 
353
  !if $wims_user!=$empty and $wims_user!=supervisor
316
   !read model/cutback.proc
354
    oef_fname=$wims_user.$oef_fname
317
  !endif
355
  !endif
318
  !mexec makedef.sh
-
 
319
 !endif mode=$empty
-
 
320
 status=waiting
-
 
321
 oef2wims_out=!record 0 of wimshome/$wims_sesdir/oef2wims.out
-
 
322
 !if ERROR iswordof $oef2wims_out
-
 
323
  :diagerror
-
 
324
  test=!line 1 of $oef2wims_out
-
 
325
  !if ERROR notin $test
-
 
326
   oef2wims_out=!line 2 to -1 of $oef2wims_out
-
 
327
  !endif
-
 
328
  error=def_fail
-
 
329
  !exit
-
 
330
 !endif
-
 
331
 replycnt=
-
 
332
 choicecnt=
-
 
333
 varcnt=
-
 
334
 !read wimshome/$wims_sesdir/submit.def
-
 
335
 !if $replycnt=$empty or $choicecnt=$empty or $varcnt=$empty
-
 
336
  !goto diagerror
-
 
337
  !exit
-
 
338
 !endif
-
 
339
 title=!trim $title
-
 
340
 !if $title=$empty
-
 
341
  error=empty_title
-
 
342
  !exit
-
 
343
 !endif
-
 
344
 oef_fname=
-
 
345
 titlen=!charcnt $title
-
 
346
 !for i=1 to $titlen
-
 
347
  c=!char $i of $title
-
 
348
  !if $c isin 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_
-
 
349
   oef_fname=$oef_fname$c
-
 
350
  !endif
-
 
351
 !next i
-
 
352
 oef_fname=!char 1 to 14 of $oef_fname
-
 
353
 !if $wims_user!=$empty and $wims_user!=supervisor
-
 
354
  oef_fname=$wims_user.$oef_fname
-
 
355
 !endif
-
 
356
!endif
356
!endif
357
 
357
 
358
!if $level=4 and $wims_user!=$empty
358
!if $level=4 and $wims_user!=$empty
359
 regout=!mexec regclass.sh
359
  regout=!mexec regclass.sh
360
 reg1=!word 1 of $regout
360
  reg1=!word 1 of $regout
361
 !if $reg1=success
361
  !if $reg1=success
362
  fnamebase=!word 2 of $regout
362
    fnamebase=!word 2 of $regout
363
  existing=$fnamebase
363
    existing=$fnamebase
364
  success=1
364
    success=1
365
 !else
-
 
366
  error=!word 2 of $regout
-
 
367
  !if $error!=already
-
 
368
   !exit
-
 
369
  !else
365
  !else
-
 
366
    error=!word 2 of $regout
-
 
367
    !if $error!=already
-
 
368
      !exit
-
 
369
    !else
370
   error=
370
      error=
371
   already=yes
371
      already=yes
-
 
372
    !endif
-
 
373
  !endif
-
 
374
  !if $wims_user!=supervisor and ..devel/ notin ..$catmodule
-
 
375
    prefix=$wims_user.
-
 
376
  !else
-
 
377
    prefix=
372
  !endif
378
  !endif
373
 !endif
-
 
374
 !if $wims_user!=supervisor and ..devel/ notin ..$catmodule
-
 
375
  prefix=$wims_user.
-
 
376
 !else
-
 
377
  prefix=
-
 
378
 !endif
-
 
379
 wims_module_log=Regclass $wims_class $mode $prefix$oef_title
379
 wims_module_log=Regclass $wims_class $mode $prefix$oef_title
380
!endif
380
!endif
381
 
381
 
382
!if $level=4
382
!if $level=4
383
 !if $catmodule1 !=
383
  !if $catmodule1 !=
384
  catmodule=devel/$wims_developer/$catmodule1
384
    catmodule=devel/$wims_developer/$catmodule1
385
  !reset catmodule1
385
    !reset catmodule1
386
 !endif
386
  !endif
387
 
387
 
388
 existing_new=!replace internal .oef by in $file_name_src
388
  existing_new=!replace internal .oef by in $file_name_src
389
 !set existing_new=!text select ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_1234567890 in $existing_new
389
  !set existing_new=!text select ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_1234567890 in $existing_new
390
 !if $existing_new != $empty
390
  !if $existing_new != $empty
391
  existing=$existing_new
391
   existing=$existing_new
392
 !endif
392
  !endif
393
!endif
393
!endif
394
!if $level=4 and $wims_developer!=$empty and ..devel/ isin ..$catmodule and \
394
!if $level=4 and $wims_developer!=$empty and ..devel/ isin ..$catmodule and \
395
   .. notin $catmodule $existing
395
   .. notin $catmodule $existing
396
 wims_exec_error=
396
  wims_exec_error=
397
 !sh cp $wims_home/sessions/$wims_session/submit.oef modules/$catmodule/src/$existing.oef\
397
  !sh cp $wims_home/sessions/$wims_session/submit.oef modules/$catmodule/src/$existing.oef\
398
    cd modules/$catmodule; src2def
398
    cd modules/$catmodule; src2def
399
 test_image=!sh ls $wims_home/sessions/$wims_session/getfile/oefimg 2>/dev/null
399
  test_image=!sh ls $wims_home/sessions/$wims_session/getfile/oefimg 2>/dev/null
400
 !if $test_image!=$empty
400
  !if $test_image!=$empty
401
   !reset test_common
401
    !reset test_common
402
   test_common=!defof common_images in wimshome/public_html/modules/$catmodule/var.proc
402
    test_common=!defof common_images in wimshome/public_html/modules/$catmodule/var.proc
403
   !if $test_common!=$empty
403
    !if $test_common!=$empty
404
    !if $test_common notwordof no yes
404
      !if $test_common notwordof no yes
405
      wims_exec_error=!append word imagedir=$test_common to $wims_exec_error
405
        wims_exec_error=!append word imagedir=$test_common to $wims_exec_error
406
    !else
406
      !else
407
     !if $test_common iswordof no or $test_common=$empty
407
        !if $test_common iswordof no or $test_common=$empty
408
       im_dir=images/$existing
408
          im_dir=images/$existing
409
     !else
409
        !else
410
       im_dir=images
410
          im_dir=images
411
     !endif
411
        !endif
412
     !sh mkdir -p modules/$catmodule/$im_dir ;\
412
        !sh mkdir -p modules/$catmodule/$im_dir ;\
413
       cp $wims_home/sessions/$wims_session/getfile/oefimg/* modules/$catmodule/$im_dir
413
        cp $wims_home/sessions/$wims_session/getfile/oefimg/* modules/$catmodule/$im_dir
-
 
414
      !endif
414
    !endif
415
    !endif
-
 
416
  !endif
-
 
417
  !reset test_image
-
 
418
  !reset already regout prefix
-
 
419
  !if $wims_exec_error=$empty
-
 
420
    reg1=success
-
 
421
    regout=$existing
-
 
422
  !else
-
 
423
    reg1=fail
-
 
424
  !endif
-
 
425
  wims_module_log=Regdev $catmodule $existing
-
 
426
  !goto l4end
-
 
427
!endif
-
 
428
 
-
 
429
!if ($level=4 and $wims_user=$empty) or $level=5
-
 
430
  regout=!mexec regpub.sh
-
 
431
  reg1=!word 1 of $regout
-
 
432
  !if $reg1=success
-
 
433
    fnamebase=!word 2 of $regout
-
 
434
  !else
-
 
435
    error=!word 2 of $regout
-
 
436
    !exit
415
  !endif
437
  !endif
416
 !endif
-
 
417
 !reset test_image
-
 
418
 !reset already regout prefix
-
 
419
 !if $wims_exec_error=$empty
-
 
420
  reg1=success
-
 
421
  regout=$existing
-
 
422
 !else
-
 
423
  reg1=fail
-
 
424
 !endif
-
 
425
 wims_module_log=Regdev $catmodule $existing
-
 
426
 !goto l4end
-
 
427
!endif
-
 
428
 
-
 
429
!if ($level=4 and $wims_user=$empty) or $level=5
-
 
430
 regout=!mexec regpub.sh
-
 
431
 reg1=!word 1 of $regout
-
 
432
 !if $reg1=success
-
 
433
  fnamebase=!word 2 of $regout
-
 
434
 !else
-
 
435
  error=!word 2 of $regout
-
 
436
  !exit
-
 
437
 !endif
-
 
438
 wims_module_log=Regpub $mode $oef_title
438
  wims_module_log=Regpub $mode $oef_title
439
!endif
439
!endif
440
 
440
 
441
:l4end
441
:l4end
442
!if $level=6
442
!if $level=6
443
 !if $wims_deposit!=$empty and .. notin $wims_deposit and / notin $wims_deposit
443
  !if $wims_deposit!=$empty and .. notin $wims_deposit and / notin $wims_deposit
444
  !read adm/du $wims_home/log/classes/$wims_class
444
    !read adm/du $wims_home/log/classes/$wims_class
445
  !if $du>=$wims_class_quota-1
445
    !if $du>=$wims_class_quota-1
446
   quota=yes
446
     quota=yes
447
  !else
447
    !else
448
   !sh cd $wims_home/$wims_sesdir\
448
     !sh cd $wims_home/$wims_sesdir\
449
	mkdir -p getfile/oefimg\
449
	    mkdir -p getfile/oefimg\
450
	mv user-deposit getfile/oefimg/$wims_deposit\
450
	    mv user-deposit getfile/oefimg/$wims_deposit\
451
	cp oefdeposit user-deposit 2>/dev/null
451
	    cp oefdeposit user-deposit 2>/dev/null
452
  !endif
452
    !endif
453
  imgfname=$wims_deposit
453
    imgfname=$wims_deposit
454
  wims_deposit=
454
    wims_deposit=
455
 !else
455
 !else
456
  !sh cd $wims_home/$wims_sesdir\
456
    !sh cd $wims_home/$wims_sesdir\
457
	if [ -f user-deposit ]; then cp user-deposit oefdeposit; fi
457
	    if [ -f user-deposit ]; then cp user-deposit oefdeposit; fi
458
  !if $delfile!=$empty and .. notin $delfile
458
    !if $delfile!=$empty and .. notin $delfile
459
   !sh rm -f $wims_home/$wims_sesdir/getfile/oefimg/$delfile
459
      !sh rm -f $wims_home/$wims_sesdir/getfile/oefimg/$delfile
-
 
460
    !endif
460
  !endif
461
  !endif
461
 !endif
-
 
462
 imglist=!filelist $wims_home/$wims_sesdir/getfile/oefimg
462
  imglist=!filelist $wims_home/$wims_sesdir/getfile/oefimg
463
 imglist=!words2items $imglist
463
  imglist=!words2items $imglist
464
!endif
464
!endif