Rev 5199 | Rev 6431 | 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 | |||
3 | max_exo=64 |
||
4 | title_limit=50 |
||
5 | desc_limit=255 |
||
6 | |||
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 |
||
29 | title=!module title $dir |
||
30 | desc=!module description $dir |
||
5210 | guerimand | 31 | cat=!module category $dir |
32 | !if exercise notin $cat and oef notin $cat |
||
33 | error=not_exo |
||
34 | !exit |
||
35 | !endif |
||
5199 | guerimand | 36 | !exit |
37 | !endif |
||
38 | |||
39 | !if $cmd=reply |
||
40 | !if ../adm/ isin ../$dir or $dir=home or \ |
||
41 | (../devel/ isin ../$dir and $wims_devel_modules notwordof open) |
||
42 | error=insert_fail |
||
43 | !exit |
||
44 | !endif |
||
45 | !if $picksheet=$empty |
||
46 | error=no_pick |
||
47 | !exit |
||
48 | !endif |
||
49 | picksheet=$[floor($picksheet)] |
||
50 | !if $picksheet=NaN or $picksheet<1 or $picksheet>min(64,$sheettot) |
||
51 | error=bad_sheet |
||
52 | !exit |
||
53 | !endif |
||
54 | sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets |
||
55 | a=!line 1 of $sh |
||
56 | !if $a>0 |
||
57 | error=bad_sheet |
||
58 | !exit |
||
59 | !endif |
||
60 | exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet |
||
61 | !if $exocnt>=$max_exo |
||
62 | error=too_many_exos |
||
63 | !exit |
||
64 | !endif |
||
65 | idesc=!singlespace $new_desc |
||
66 | idesc=!char 1 to $desc_limit of $idesc |
||
67 | ititle=!singlespace $title |
||
68 | ititle=!char 1 to $title_limit of $ititle |
||
69 | !if $scoring=yes |
||
70 | require=$[$require] |
||
71 | weight=$[$weight] |
||
72 | !if NaN isin $require |
||
73 | require=0 |
||
74 | !endif |
||
75 | !if NaN isin $weight |
||
76 | weight=0 |
||
77 | !endif |
||
78 | !bound require between 0,1000 default 0 |
||
79 | !bound weight between 0,10 default 0 |
||
80 | !endif |
||
81 | !for i=1 to $exocnt |
||
82 | e=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$picksheet |
||
83 | !distribute lines $e into wdi,win |
||
84 | !if $dir=$wdi and $iniparm=$win |
||
85 | test=$picksheet |
||
86 | error=already_exist |
||
87 | !exit |
||
88 | !endif |
||
89 | !next i |
||
90 | !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$picksheet :$dir\ |
||
91 | $iniparm\ |
||
92 | $require\ |
||
93 | $weight\ |
||
94 | $ititle\ |
||
95 | $idesc |
||
96 | |||
97 | exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet |
||
98 | wims_module_log=class $class: add No$exocnt to worksheet $picksheet |
||
99 | !endif |
||
100 |