Rev 16087 | Rev 16467 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 16087 | Rev 16307 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | !! add exercise in a freework |
1 | !! add exercise in a freework type=3 ; zonetype=wimsexo |
2 | 2 | ||
3 | max_exos=!defof MAX_EXOS in wimshome/public_html/bases/sys/define.conf |
3 | max_exos=!defof MAX_EXOS in wimshome/public_html/bases/sys/define.conf |
4 | desc_limit=255 |
4 | desc_limit=255 |
5 | 5 | ||
6 | !! ----------- delete intro_sol>0 in iniparm |
6 | !! ----------- delete intro_sol>0 in iniparm |
Line 29... | Line 29... | ||
29 | iniparm=$iniparm&intro_expert=yes&intro_sol=0 |
29 | iniparm=$iniparm&intro_expert=yes&intro_sol=0 |
30 | !endif |
30 | !endif |
31 | !! --------- end |
31 | !! --------- end |
32 | 32 | ||
33 | !if $cmd=new or $cmd=resume |
33 | !if $cmd=new or $cmd=resume |
34 |
|
34 | freeworkslist=$empty |
35 | !for i=1 to $nbfreework |
35 | !for i=1 to $nbfreework |
36 | sh=!record $i of wimshome/log/classes/$wims_class/freeworks/.freeworks |
36 | sh=!record $i of wimshome/log/classes/$wims_class/freeworks/.freeworks |
37 | !distribute lines $sh into stat,t_,title,t_,t_,type |
37 | !distribute lines $sh into stat,t_,title,t_,t_,type |
38 | !if $stat<1 and |
38 | !if $stat<1 and $type=3 |
- | 39 | nb_=!recordcnt wimshome/log/classes/$wims_class/freeworks/.freework$i |
|
- | 40 | j=1 |
|
- | 41 | test=0 |
|
- | 42 | !while $j<=$nb_ and $test=0 |
|
- | 43 | dt=!record $j of wimshome/log/classes/$wims_class/freeworks/.freework$i |
|
- | 44 | dt=!word 1 of $dt |
|
- | 45 | !if wimsexo isin $dt |
|
- | 46 | test=1 |
|
- | 47 | !endif |
|
- | 48 | !increase j |
|
- | 49 | !endwhile |
|
- | 50 | !if $test=1 |
|
39 | freeworkslist=!append line $i,$title to $freeworkslist |
51 | freeworkslist=!append line $i,$title to $freeworkslist |
- | 52 | !endif |
|
40 | !endif |
53 | !endif |
41 | !next i |
54 | !next i |
- | 55 | !if $freeworkslist=$empty |
|
- | 56 | freeworkscnt=0 |
|
- | 57 | !else |
|
42 | freeworkscnt=!linecnt $freeworkslist |
58 | freeworkscnt=!linecnt $freeworkslist |
- | 59 | !endif |
|
43 | !ifval $freeworkscnt=0 |
60 | !ifval $freeworkscnt=0 |
44 | error=addexo-nofreework |
61 | error=addexo-nofreework |
45 | notallowed=1 |
62 | notallowed=1 |
46 | !exit |
63 | !exit |
47 | !endif |
64 | !endif |
48 | test_transl=!module translation_language $dir |
65 | test_transl=!module translation_language $dir |
49 | !if $lang iswordof $test_transl |
66 | !if $lang iswordof $test_transl |
50 | tr_lang=yes |
67 | tr_lang=yes |
51 | title=!module title_$lang $dir |
68 | title=!module title_$lang $dir |
Line 58... | Line 75... | ||
58 | !default title=!module title $dir |
75 | !default title=!module title $dir |
59 | !default desc=!module description $dir |
76 | !default desc=!module description $dir |
60 | cat=!module category $dir |
77 | cat=!module category $dir |
61 | !if exercise notin $cat and oef notin $cat |
78 | !if exercise notin $cat and oef notin $cat |
62 | error=not_exo |
79 | error=not_exo |
63 | !exit |
80 | !exit |
64 | !endif |
81 | !endif |
65 | !exit |
82 | !exit |
66 | !endif |
83 | !endif |
67 | 84 | ||
68 | !if $cmd=reply |
85 | !if $cmd=reply |
69 | !if ../adm/ isin ../$dir or $dir=home or \ |
86 | !if ../adm/ isin ../$dir or $dir=home or \ |
Line 71... | Line 88... | ||
71 | error=insert_fail |
88 | error=insert_fail |
72 | !exit |
89 | !exit |
73 | !endif |
90 | !endif |
74 | !if $pickfreework=$empty |
91 | !if $pickfreework=$empty |
75 | error=no_pick |
92 | error=no_pick |
76 | !exit |
93 | !exit |
77 | !endif |
94 | !endif |
78 | pickfreework=$[floor($pickfreework)] |
95 | pickfreework=$[floor($pickfreework)] |
79 | !if $pickfreework=NaN or $pickfreework<1 or $picksfreework>min($max_freeworks,$nbfreeworks) |
96 | !if $pickfreework=NaN or $pickfreework<1 or $picksfreework>min($max_freeworks,$nbfreeworks) |
80 | error=bad_freework |
97 | error=bad_freework |
81 | !exit |
98 | !exit |
82 | !endif |
99 | !endif |
83 | sh=!record $pickfreework of wimshome/log/classes/$wims_class/freeworks/.freeworks |
100 | sh=!record $pickfreework of wimshome/log/classes/$wims_class/freeworks/.freeworks |
84 | a=!line 1 of $sh |
101 | a=!line 1 of $sh |
85 | t=!line 6 of $sh |
102 | t=!line 6 of $sh |
86 | !if $a>0 or |
103 | !if $a>0 or $t!=3 |
- | 104 | nb_=!recordcnt wimshome/log/classes/$wims_class/freeworks/.freework$pickfreework |
|
- | 105 | j=1 |
|
- | 106 | test=0 |
|
- | 107 | !while $j<=$nb_ and $test=0 |
|
- | 108 | dt=!record $j of wimshome/log/classes/$wims_class/freeworks/.freework$pickfreework |
|
- | 109 | dt=!word 1 of $dt |
|
- | 110 | !if wimsexo isin $dt |
|
- | 111 | test=1 |
|
- | 112 | !endif |
|
- | 113 | !increase j |
|
- | 114 | !endwhile |
|
- | 115 | !if $test=0 |
|
87 | error=bad_freework |
116 | error=bad_freework |
88 | !exit |
117 | !exit |
- | 118 | !endif |
|
89 | !endif |
119 | !endif |
90 | exocnt=!recordcnt wimshome/log/classes/$wims_class/freeworks/. |
120 | exocnt=!recordcnt wimshome/log/classes/$wims_class/freeworks/.Wfreework$pickfreework |
91 | !if $exocnt>=$max_exos |
121 | !if $exocnt>=$max_exos |
92 | error=too_many_exos |
122 | error=too_many_exos |
93 | !exit |
123 | !exit |
94 | !endif |
124 | !endif |
95 | idesc=!singlespace $new_desc |
125 | idesc=!singlespace $new_desc |
Line 98... | Line 128... | ||
98 | iobs=!singlespace $obs |
128 | iobs=!singlespace $obs |
99 | iobs=!char 1 to $desc_limit of $iobs |
129 | iobs=!char 1 to $desc_limit of $iobs |
100 | ititle=!singlespace $title |
130 | ititle=!singlespace $title |
101 | ititle=!char 1 to $title_limit of $ititle |
131 | ititle=!char 1 to $title_limit of $ititle |
102 | !for i=1 to $exocnt |
132 | !for i=1 to $exocnt |
103 | e=!record $i of wimshome/log/classes/$wims_class/freeworks/. |
133 | e=!record $i of wimshome/log/classes/$wims_class/freeworks/.Wfreework$pickfreework |
104 | !distribute lines $e into wdi,win |
134 | !distribute lines $e into wdi,win |
105 | !if $dir=$wdi and $iniparm=$win |
135 | !if $dir=$wdi and $iniparm=$win |
106 | test=$pickfreework |
136 | test=$pickfreework |
107 | error=already_exist |
137 | error=already_exist |
108 | !exit |
138 | !exit |
109 | !endif |
139 | !endif |
110 | !next i |
140 | !next i |
111 | !appendfile wimshome/log/classes/$wims_class/freeworks/. |
141 | !appendfile wimshome/log/classes/$wims_class/freeworks/.Wfreework$pickfreework :$dir\ |
112 | $iniparm\ |
142 | $iniparm\ |
113 | $ititle\ |
143 | $ititle\ |
114 | $idesc |
144 | $idesc |
115 | success=exo-insert |
145 | success=exo-insert |
116 | exocnt=!recordcnt wimshome/log/classes/$wims_class/freeworks/. |
146 | exocnt=!recordcnt wimshome/log/classes/$wims_class/freeworks/.Wfreework$pickfreework |
117 | wims_module_log=class $class: add No$exocnt to freework $pickfreework |
147 | wims_module_log=class $class: add No$exocnt to freework $pickfreework |
118 | !endif |
148 | !endif |