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 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
|
!read adm/language lang/names.phtml
!if $wims_developer!=$empty
!set wims_ariane_self=no
!set wims_ariane=!append line modtool,1,module=adm/modtool&job=flist&modreq=$catmodule\
to $wims_ariane
!endif
wims_helper=chapter=4&open=4_oef#oef
wims_form_method=post
wims_nw=existing catmodule catmodule1 newone oef_fname level vsave \
delete deltitle mode realtest deffile wims_noexport \
empty wims_module_log class_header
wims_nr=wims_sesrandom
wims_trustfile=oef/embed.phtml oef/special.phtml oef/togetfile.proc
slib/circuits/draw slib/circuits/drawcomp slib/circuits/range\
slib/circuits/comppos
answerlim=!defof MAX_OEFREPLIES in wimshome/public_html/bases/sys/define.conf
choicelim=!defof MAX_OEFCHOICES in wimshome/public_html/bases/sys/define.conf
!distribute item 10,40 into condlim,promptlim
!bound mode within raw,file,model default $
!read tabletheme
!if $wims_user!=$empty or $wims_developer!=$empty
!default oef_author=!trim $wims_firstname $wims_lastname
!default oef_email=$wims_email
!if $wims_developer!=$empty
!read adm/getdeveloper
!default oef_author=$dv_name
!default oef_email=$dv_email
!endif
!if $newone=1
existing=
newone=
!endif
!if (..devel/ notin ..$catmodule or $wims_developer=$empty) and \
$existing!=$empty and $wims_user!=supervisor \
and ..*/$wims_user. notin ..*/$existing
existing=
!endif
!if $existing!=$empty and $level=$empty
!if $catmodule!=$empty
!if ..devel/ isin ..$catmodule and ($wims_developer= or \
..devel/$wims_developer notin ..$catmodule)
!goto nonexist
!endif
!if .. isin $catmodule or ..adm/ isin ..$catmodule or \
..classes/ isin ..$catmodule
!goto nonexist
!endif
!endif
src=!mexec catexisting.sh $existing
!if $src!=$empty
mode=raw
level=1
!else
:nonexist
error=not_exist
del=$existing
existing=
!exit
!endif
!endif
!else
existing=
!endif
!if $cmd=help
!if $realtest=yes
!!variable for ariane
!set ariane_title=$$wims_name_createxo
!set wims_ariane=!append line backcreatexo,1,module=adm/createxo&cmd=resume&realtest=no\
testexo,1,module=$module&cmd=resume\
to $wims_ariane
!changeto oef/var.proc
!else
!set wims_ariane=!append line resume,1,module=$module&cmd=resume\
to $wims_ariane
!if $modtoolhelp!=yes
!!trouble with mhelp=%2Cmhelp (coming from ,mhelp)
!if $special_parm!=$empty and ($special_parm notwordof mhelp help and mhelp notin $special_parm)
!set wims_ariane=!append line back2 $$wims_name_help,1,cmd=help\
to $wims_ariane
!endif
!endif
!endif
!if $modtoolhelp=yes
!distribute items no,no, into wims_ariane_home,wims_ariane_self,wims_ariane
!endif
!exit
!endif
!if $modtoolhelp=yes
!distribute items no,no, into wims_ariane_home,wims_ariane_self,wims_ariane
!endif
!if $delete!=$empty
!if $wims_class==$empty
error=not_class
!exit
!endif
!if $wims_user!=supervisor
error=not_supervisor
!exit
!endif
del=!word 1 of $delete
delete=
deleted=!mexec delexo.sh $del
!if $deleted=$empty
error=not_exist
!else
wims_module_log=delete $wims_class/$del
!endif
!exit
!endif
!if $level notwordof 2 and ($realtest!=no and $realtest!=$empty)
!set wims_ariane=!append line backcreatexo,1,cmd=resume&realtest=no\
to $wims_ariane
!endif
!if $level iswordof 6
!set wims_ariane=!append line backcreatexo,1,cmd=reply&level=3\
to $wims_ariane
!endif
!if $mode=model and $model!=$empty
model=!text select abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 in $model
!sh cp -f $wims_home/public_html/scripts/model/$lang/src/$model.oef $wims_home/sessions/$wims_session/user-deposit\
cp -f $wims_home/sessions/$wims_session/user-deposit $wims_home/sessions/$wims_session/submit.oef
!if $level=3 and $realtest=yes
!mexec makedef.sh
!endif
!reset status
model=
!endif
!if $level=2 and $mode=model
!read model/cut.proc
!if $cnt<6 or $sps=$empty or $parms=$empty or $desc=$empty or\
$model_type=$empty or statementrec=$empty
mode=
!goto nomodel
!endif
!set wims_ariane=!append line modellist,1,cmd=reply&level=1&mode=model\
to $wims_ariane
!endif
!if $level=2 and $mode=$empty
!set wims_ariane=!append line normalmode,1,cmd=reply&level=1\
to $wims_ariane
!read model/cut.proc
!if $cnt>=6 and $sps!=$empty and $parms!=$empty and $desc!=$empty and\
$model_type!=$empty and statementrec>1
mode=model
rawinp=
!endif
!endif
:nomodel
!if $level=3 and $realtest=yes
oef_test=yes
!changeto oef/var.proc
!else
!if $realtest=no
question=
hint=
solution=
status=
varcnt=0
replycnt=0
choicecnt=0
score=
!if $mode=model
!for i=1 to 100
reply$i=
!next i
!endif model
!endif realtest
!reset status realtest retest
!endif level=3
!if $rawinp!=$empty
mode=raw
level=1
rawinp=
!endif
!if $mode=raw and $level<=2
modeltest=!recordcnt wimshome/sessions/$wims_session/submit.oef
!if $modeltest>6
modeltest=!record 0 of wimshome/sessions/$wims_session/submit.oef
modeltest=!getopt type in $modeltest
!if $modeltest!=$empty
modeltest=yes
!sh cd $wims_home/sessions/$wims_session\
[ -s user-deposit ] || cp -f submit.oef user-deposit
!endif
!endif
!endif
!bound oef_format within tex,html default html
!bound oef_answercnt between integer 0 and $answerlim default 1
!bound oef_choicecnt between integer 0 and $choicelim default 0
!bound oef_condcnt between integer 0 and $condlim default 0
!bound oef_precision within 100,1000,10000,100000,1000000 default 10000
!bound oef_computeanswer within yes,no default no
!bound level between integer 0 and 7 default 0
!if $level=6 and $wims_user!=supervisor
level=1
!endif
!for i in l,r
oef_range$i=!trim $(oef_range$i)
!if $(oef_range$i)!=$empty
oef_range$i=$[$(oef_range$i)]
!if NaN isin $(oef_range$i)] or Inf isin $(oef_range$i)
oef_range$i=
!endif
!endif
!next i
!default oef_rangel=-5
!default oef_ranger=5
!if $oef_rangel=$oef_ranger
oef_rangel=-5
oef_ranger=5
!endif
!if $oef_rangel>$oef_ranger
range=$oef_rangel
oef_rangel=$oef_ranger
oef_ranger=$range
!endif
!if $level>1 and $mode=$empty
oef_title=!trim $oef_title
!if $oef_title=$empty and $level>1
error=no_title
!exit
!endif
# !if $oef_answercnt+$oef_choicecnt<=0
# error=no_answer
# !exit
# !endif
!endif
!if $level=7 and $wims_developer!=$empty
!reset file_name_src
list_mod=!sh ls $wims_home/public_html/modules/devel/$wims_developer
list_mod=!words2items $list_mod
list_mod_oef=
!for a in $list_mod
category = !module category devel/$wims_developer/$a
!if oef isin $category
list_mod_oef=!append item $a to $list_mod_oef
!endif
!next
!if $list_mod_oef=$empty
error = $error oefempty
!endif
!endif
!if $level=3
!if $mode=$empty
header=\language{$lang}\
\range{$oef_rangel..$oef_ranger}
!for i in author,email,computeanswer,format,precision
oef_$i=!trim $(oef_$i)
!if $(oef_$i)!=$empty
header=!append line \$i{$(oef_$i)} to $header
!endif
!next i
oef_statement=!trim $oef_statement
!if $oef_statement=$empty
error=no_statement
!exit
!endif
answers=
!for i=1 to $oef_answercnt
ansprompt$i=!trim $(ansprompt$i)
prompt=!char 1 to $promptlim of $(ansprompt$i)
ansgood$i=!trim $(ansgood$i)
!if $prompt!=$empty and $(ansgood$i)!=$empty
!default anstype$i=default
answers=!append line \answer{$prompt}{$(ansgood$i)}{type=$(anstype$i)} to $answers
!endif
!next i
replycnt=!linecnt $answers
choices=
!for i=1 to $oef_choicecnt
choiprompt$i=!trim $(choiprompt$i)
prompt=!char 1 to $promptlim of $(choiprompt$i)
choigood$i=!trim $(choigood$i)
choibad$i=!trim $(choibad$i)
!if $prompt!=$empty and $(choigood$i)!=$empty and $(choibad$i)!=$empty
choices=!append line \choice{$prompt}{$(choigood$i)}{$(choibad$i)} to $choices
!endif
!next i
choicecnt=!linecnt $choices
conditions=
!for i=1 to $oef_condcnt
cn=!trim $(Condname$i)
ct=!trim $(Condtest$i)
!if $cn!=$empty and $ct!=$empty
conditions=!append line \condition{$cn}{$ct} to $conditions
!endif
!next i
# !ifval $replycnt+$choicecnt=0
# error=no_reply2
# !exit
# !endif
oef_hint=!trim $oef_hint
!if $oef_hint!=$empty
hints=\hint{$oef_hint}
!endif
oef_solution=!trim $oef_solution
!if $oef_solution!=$empty
solutions=\solution{$oef_solution}
!endif
source=!mexec makedef.sh
!else
!if $mode=model
!read model/cutback.proc
!endif
!mexec makedef.sh
!endif mode=$empty
status=waiting
oef2wims_out=!record 0 of wimshome/$wims_sesdir/oef2wims.out
!if ERROR iswordof $oef2wims_out
:diagerror
test=!line 1 of $oef2wims_out
!if ERROR notin $test
oef2wims_out=!line 2 to -1 of $oef2wims_out
!endif
error=def_fail
!exit
!endif
replycnt=
choicecnt=
varcnt=
!read wimshome/$wims_sesdir/submit.def
!if $replycnt=$empty or $choicecnt=$empty or $varcnt=$empty
!goto diagerror
!exit
!endif
title=!trim $title
!if $title=$empty
error=empty_title
!exit
!endif
oef_fname=
titlen=!charcnt $title
!for i=1 to $titlen
c=!char $i of $title
!if $c isin 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_
oef_fname=$oef_fname$c
!endif
!next i
oef_fname=!char 1 to 14 of $oef_fname
!if $wims_user!=$empty and $wims_user!=supervisor
oef_fname=$wims_user.$oef_fname
!endif
!endif
!if $level=4 and $wims_user!=$empty
regout=!mexec regclass.sh
reg1=!word 1 of $regout
!if $reg1=success
fnamebase=!word 2 of $regout
existing=$fnamebase
success=1
!else
error=!word 2 of $regout
!if $error!=already
!exit
!else
error=
already=yes
!endif
!endif
!if $wims_user!=supervisor and ..devel/ notin ..$catmodule
prefix=$wims_user.
!else
prefix=
!endif
wims_module_log=Regclass $wims_class $mode $prefix$oef_title
!endif
!if $level=4
!if $catmodule1 !=
catmodule=devel/$wims_developer/$catmodule1
!reset catmodule1
!endif
existing_new=!replace internal .oef by in $file_name_src
!set existing_new=!text select ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_1234567890 in $existing_new
!if $existing_new != $empty
existing=$existing_new
!endif
!endif
!if $level=4 and $wims_developer!=$empty and ..devel/ isin ..$catmodule and \
.. notin $catmodule $existing
wims_exec_error=
!sh cp $wims_home/sessions/$wims_session/submit.oef modules/$catmodule/src/$existing.oef\
cd modules/$catmodule; src2def
test_image=!sh ls $wims_home/sessions/$wims_session/getfile/oefimg 2>/dev/null
!if $test_image!=$empty
!reset test_common
test_common=!defof common_images in wimshome/public_html/modules/$catmodule/var.proc
!if $test_common!=$empty
!if $test_common notwordof no yes
wims_exec_error=!append word imagedir=$test_common to $wims_exec_error
!else
!if $test_common iswordof no or $test_common=$empty
im_dir=images/$existing
!else
im_dir=images
!endif
!sh mkdir -p modules/$catmodule/$im_dir ;\
cp $wims_home/sessions/$wims_session/getfile/oefimg/* modules/$catmodule/$im_dir
!endif
!endif
!endif
!reset test_image
!reset already regout prefix
!if $wims_exec_error=$empty
reg1=success
regout=$existing
!else
reg1=fail
!endif
wims_module_log=Regdev $catmodule $existing
!goto l4end
!endif
!if ($level=4 and $wims_user=$empty) or $level=5
regout=!mexec regpub.sh
reg1=!word 1 of $regout
!if $reg1=success
fnamebase=!word 2 of $regout
!else
error=!word 2 of $regout
!exit
!endif
wims_module_log=Regpub $mode $oef_title
!endif
:l4end
!if $level=6
!readproc adm/class/quotafree.proc proc
!if $wims_deposit!=$empty and .. notin $wims_deposit and / notin $wims_deposit
!if $quota_free>1
!sh cd $wims_home/$wims_sesdir\
mkdir -p getfile/oefimg\
mv user-deposit getfile/oefimg/$wims_deposit\
cp oefdeposit user-deposit 2>/dev/null
!endif
imgfname=$wims_deposit
wims_deposit=
!else
!sh cd $wims_home/$wims_sesdir\
if [ -f user-deposit ]; then cp user-deposit oefdeposit; fi
!if $delfile!=$empty and .. notin $delfile
!sh rm -f $wims_home/$wims_sesdir/getfile/oefimg/$delfile
!endif
!endif
imglist=!filelist $wims_home/$wims_sesdir/getfile/oefimg
imglist=!words2items $imglist
!endif
|