Subversion Repositories wimsdev

Rev

Rev 8255 | Rev 9436 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5199 guerimand 1
!! add exercise in a sheet
2
 
8255 bpr 3
max_exos=!defof MAX_EXOS in wimshome/public_html/bases/sys/define.conf
4
max_sheets=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
5199 guerimand 5
title_limit=50
6
desc_limit=255
7
!if $scoring=yes
8
 !default require=10
9
 !default weight=1
10
!else
11
 require=0
12
 weight=0
13
!endif
14
 
15
!if $cmd=new or $cmd=resume
16
 sheets=
17
 !for i=1 to $sheettot
18
  sh=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
19
  !distribute lines $sh into a_,t_,title
20
  !if $a_<1
21
   sheets=!append line $i,$title to $sheets
22
  !endif
23
 !next i
24
 sheetcnt=!linecnt $sheets
25
 !ifval $sheetcnt=0
26
  error=no_sheet
27
  !exit
28
 !endif
6431 bpr 29
 test_transl=!module translation_language $dir
30
 !if $lang iswordof $test_transl
31
   tr_lang=yes
32
   title=!module title_$lang $dir
33
   desc=!module description_$lang $dir
34
 !endif
35
 !default title=!module title $dir
36
 !default desc=!module description $dir
5210 guerimand 37
 cat=!module category $dir
38
 !if exercise notin $cat and oef notin $cat
39
  error=not_exo
40
  !exit
41
 !endif
5199 guerimand 42
 !exit
43
!endif
44
 
45
!if $cmd=reply
46
 !if ../adm/ isin ../$dir or $dir=home or \
47
   (../devel/ isin ../$dir and $wims_devel_modules notwordof open)
48
  error=insert_fail
49
  !exit
50
 !endif
51
 !if $picksheet=$empty
52
  error=no_pick
53
  !exit
54
 !endif
55
 picksheet=$[floor($picksheet)]
8255 bpr 56
 !if $picksheet=NaN or $picksheet<1 or $picksheet>min($max_sheets,$sheettot)
5199 guerimand 57
  error=bad_sheet
58
  !exit
59
 !endif
60
 sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
61
 a=!line 1 of $sh
62
 !if $a>0
63
  error=bad_sheet
64
  !exit
65
 !endif
66
 exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
8255 bpr 67
 !if $exocnt>=$max_exos
5199 guerimand 68
  error=too_many_exos
69
  !exit
70
 !endif
71
 idesc=!singlespace $new_desc
72
 idesc=!char 1 to $desc_limit of $idesc
73
 ititle=!singlespace $title
74
 ititle=!char 1 to $title_limit of $ititle
75
 !if $scoring=yes
76
  require=$[$require]
77
  weight=$[$weight]
78
  !if NaN isin $require
79
   require=0
80
  !endif
81
  !if NaN isin $weight
82
   weight=0
83
  !endif
8255 bpr 84
  !bound require between 0,$[10*$require_limit] default 0
5199 guerimand 85
  !bound weight between 0,10 default 0
86
 !endif
87
 !for i=1 to $exocnt
88
  e=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
89
  !distribute lines $e into wdi,win
90
  !if $dir=$wdi and $iniparm=$win
91
   test=$picksheet
92
   error=already_exist
93
   !exit
94
  !endif
95
 !next i
7354 bpr 96
####
97
  !if $get_random=0
98
  !for i=1 to $get_qnum
99
    update_order=!append item $(update_ex$i) to $update_order
100
  !next
101
 
102
  get_exo=$(get_exo[$update_order])
103
  iniparm2=!replace internal & by $\
104
$ in $iniparm
105
  iniparm2_cnt=!linecnt $iniparm2
106
  new_iniparm=
107
  equal==
108
  !for v in $get_exo
109
    new_iniparm=!append item exo=$v to $new_iniparm
110
  !next
111
  !for u=1 to $iniparm2_cnt
112
    l=!line $u of $iniparm2
113
    !if exo$equal notin $l
114
     new_iniparm=!append item $l to $new_iniparm
115
    !endif
116
  !next
117
  new_iniparm=!nospace $new_iniparm
118
  new_iniparm=!replace internal , by & in $new_iniparm=
119
  iniparm=$new_iniparm
120
!endif
121
#####
5199 guerimand 122
 !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$picksheet :$dir\
123
$iniparm\
124
$require\
125
$weight\
126
$ititle\
127
$idesc
128
 
129
 exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
130
 wims_module_log=class $class: add No$exocnt to worksheet $picksheet
131
!endif