Rev 9963 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9963 | Rev 10939 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | # Ajoute du contenu (un exercice existant) a la feuille $qsheet de la classe $qclass |
2 | # Ajoute du contenu (un exercice existant) a la feuille $qsheet de la classe $qclass |
3 | 3 | ||
4 | #Pour commencer, on verifie la classe |
4 | #Pour commencer, on verifie la classe |
5 | !read scripts/check.class |
5 | !read scripts/check.class |
6 | !if $error!=$empty |
6 | !if $error!=$empty |
7 | !exit |
7 | !exit |
8 | !endif |
8 | !endif |
9 | 9 | ||
10 | type=sheets |
10 | type=sheets |
11 | !read scripts/check.proc |
11 | !read scripts/check.proc |
12 | !if $error!=$empty |
12 | !if $error!=$empty |
13 | !exit |
13 | !exit |
14 | !endif |
14 | !endif |
15 | 15 | ||
16 | #On verifie que la feuille n'est pas "Active" |
16 | #On verifie que la feuille n'est pas "Active" |
17 | sheet_status=!line 1 of $qproperties |
17 | sheet_status=!line 1 of $qproperties |
18 | !ifval $sheet_status >0 |
18 | !ifval $sheet_status >0 |
19 | error=sheet mustn't be active |
19 | error=sheet mustn't be active |
20 | !exit |
20 | !exit |
21 | !endif |
21 | !endif |
22 | 22 | ||
23 | exocnt=!recordcnt wimshome/log/classes/$qclass/sheets/.sheet$wims_sheet |
23 | exocnt=!recordcnt wimshome/log/classes/$qclass/sheets/.sheet$wims_sheet |
24 | !if $exocnt >= $MAX_EXOS |
24 | !if $exocnt >= $MAX_EXOS |
25 | error=Sorry, a sheet is limited to $MAX_EXOS exercises. |
25 | error=Sorry, a sheet is limited to $MAX_EXOS exercises. |
26 | !exit |
26 | !exit |
27 | !endif |
27 | !endif |
28 | 28 | ||
29 | !if $data1=$empty |
29 | !if $data1=$empty |
30 | error=no data found |
30 | error=no data found |
31 | !exit |
31 | !exit |
32 | !endif |
32 | !endif |
33 | 33 | ||
34 | data1=!nonempty lines $data1 |
34 | data1=!nonempty lines $data1 |
35 | n1=!linecnt $data1 |
35 | n1=!linecnt $data1 |
36 | !for i=1 to $n1 |
36 | !for i=1 to $n1 |
37 | v_=$empty |
37 | v_=$empty |
38 | l=!line $i of $data1 |
38 | l=!line $i of $data1 |
39 | #On remplace temporairement les eventuelles virgules pour ne pas interferer avec la suite |
39 | #On remplace temporairement les eventuelles virgules pour ne pas interferer avec la suite |
40 | l2=!translate , to XTEMPX in $l |
40 | l2=!translate , to XTEMPX in $l |
41 | l2=!translate = to $,$ in $l2 |
41 | l2=!translate = to $,$ in $l2 |
42 | n_=!item 1 of $l2 |
42 | n_=!item 1 of $l2 |
43 | v_=!item 2 of $l2 |
43 | v_=!item 2 of $l2 |
44 | nb_elem=!itemcnt $l2 |
44 | nb_elem=!itemcnt $l2 |
45 | !if $nb_elem>2 |
45 | !if $nb_elem>2 |
46 | !for j=3 to $nb_elem |
46 | !for j=3 to $nb_elem |
47 | courrant=!item $j of $l2 |
47 | courrant=!item $j of $l2 |
48 | v_=$v_=$courrant |
48 | v_=$v_=$courrant |
49 | !next j |
49 | !next j |
50 | !endif |
50 | !endif |
51 | # puis on remet en place les virgules |
51 | # puis on remet en place les virgules |
52 | v_=!translate XTEMPX to $,$ in $v_ |
52 | v_=!translate XTEMPX to $,$ in $v_ |
53 | sh_$n_=$v_ |
53 | sh_$n_=$v_ |
54 | !next i |
54 | !next i |
55 | - | ||
56 | 55 | ||
57 | 56 | ||
58 | !for t in sh_module, sh_params |
57 | !for t in sh_module, sh_params |
59 | !if $($t) = $empty |
58 | !if $($t) = $empty |
60 | error=incomplete data $t |
59 | error=incomplete data $t |
61 | !exit |
60 | !exit |
62 | !endif |
61 | !endif |
63 | !next t |
62 | !next t |
64 | 63 | ||
65 | !default sh_weight=1 |
64 | !default sh_weight=1 |
66 | !default sh_points=10 |
65 | !default sh_points=10 |
67 | !default sh_title=Nouvel exercice |
66 | !default sh_title=Nouvel exercice |
68 | !default sh_description=$empty |
67 | !default sh_description=$empty |
69 | !default sh_dep=$empty |
68 | !default sh_dep=$empty |
70 | !default sh_comment=$empty |
69 | !default sh_comment=$empty |
71 | 70 | ||
72 | 71 | ||
73 | # On remplace les eventuels codes URI (%2F, etc..) par les caracteres adequats |
72 | # On remplace les eventuels codes URI (%2F, etc..) par les caracteres adequats |
74 | !read adm/urldecode $sh_module |
73 | !read adm/urldecode $sh_module |
75 |
|
74 | sh_module=$url |
- | 75 | ||
- | 76 | !if $sh_module=$empty |
|
- | 77 | error=urldecode failure ! Make sure URI::URL perl module is well installed on the server. |
|
- | 78 | !exit |
|
- | 79 | !endif |
|
76 | 80 | ||
77 | !appendfile wimshome/log/classes/$qclass/sheets/.sheet$qsheet \ |
81 | !appendfile wimshome/log/classes/$qclass/sheets/.sheet$qsheet \ |
78 | :$sh_module\ |
82 | :$sh_module\ |
79 | $sh_params\ |
83 | $sh_params\ |
80 | $sh_points\ |
84 | $sh_points\ |
81 | $sh_weight\ |
85 | $sh_weight\ |
82 | $sh_title\ |
86 | $sh_title\ |
83 | $sh_description\ |
87 | $sh_description\ |
84 | $sh_dep\ |
88 | $sh_dep\ |
85 | $sh_comment\ |
89 | $sh_comment\ |
86 | - | ||
87 | 90 | ||
88 | 91 | ||
89 | exocnt=!recordcnt wimshome/log/classes/$qclass/sheets/.sheet$wims_sheet |
92 | exocnt=!recordcnt wimshome/log/classes/$qclass/sheets/.sheet$wims_sheet |