Rev 16027 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
12274 | bpr | 1 | !!### score, mode (for mode=legend, score can be empty) |
2 | |||
7943 | bpr | 3 | !distribute items $wims_read_parm into t0_,tc_ |
12399 | bpr | 4 | !! last color is for unfinished exercise |
7770 | bpr | 5 | |
14838 | obado | 6 | !set colorhexa=#FF0000,#FF0000,#FF0000,#FF9922,#FF9922,#FF9922,#FFE338,#FFE338,#00B000,#008F00,#008F00,#FFFFFF |
7943 | bpr | 7 | !set class_scorecolor=!nonempty items $class_scorecolor |
12447 | bpr | 8 | !set class_scorecolorcnt=!itemcnt $class_scorecolor |
9 | !!color unfinished |
||
12463 | bpr | 10 | !if $class_scorecolorcnt<12 and $class_scorecolorcnt>0 |
12447 | bpr | 11 | !set class_scorecolor=$class_scorecolor,#D3D3D3 |
12 | !endif |
||
7943 | bpr | 13 | !if $class_scorecolor=$empty |
1953 | guerimand | 14 | !set class_scorecolor=!defof class_scorecolor in wimshome/log/classes/$wims_class/.def |
7770 | bpr | 15 | !set class_scorecolor=!nonempty items $class_scorecolor |
16 | !default class_scorecolor=$colorhexa |
||
7943 | bpr | 17 | !endif |
12463 | bpr | 18 | |
10454 | obado | 19 | !set class_scorecolor=!replace internal white by $(colorhexa[1]) in $class_scorecolor |
20 | !set class_scorecolor=!replace internal red by $(colorhexa[2]) in $class_scorecolor |
||
21 | !set class_scorecolor=!replace internal orange by $(colorhexa[5]) in $class_scorecolor |
||
22 | !set class_scorecolor=!replace internal yellow by $(colorhexa[8]) in $class_scorecolor |
||
23 | !set class_scorecolor=!replace internal green by $(colorhexa[10]) in $class_scorecolor |
||
7942 | obado | 24 | |
7943 | bpr | 25 | !default tc_=background |
7772 | bpr | 26 | |
7943 | bpr | 27 | !if $t0_=$empty |
28 | !exit |
||
29 | !endif |
||
7908 | obado | 30 | |
7943 | bpr | 31 | !goto $tc_ |
7908 | obado | 32 | |
7943 | bpr | 33 | :background |
34 | |||
35 | !set style_note="background-color:$(class_scorecolor[$t0_+1]);" class="wims_sheet_score" |
||
36 | |||
37 | !exit |
||
38 | :color |
||
39 | |||
12264 | bpr | 40 | !set style_note=" |
16029 | bpr | 41 | !if $(class_scorecolor[$t0_+1]) issametext #FFFFFF |
13605 | obado | 42 | !set style_note=$style_note;color:#666; |
1953 | guerimand | 43 | !else |
16027 | bpr | 44 | !set style_note=$style_note;color:$(class_scorecolor[$t0_+1]); |
7943 | bpr | 45 | !endif |
12286 | obado | 46 | !set style_note=$style_note" class="wims_sheet_score |
7943 | bpr | 47 | |
13167 | bpr | 48 | !! Add Trophy icon fo scores >=8 |
49 | !if $t0_>=9.5 |
||
12342 | bpr | 50 | !set style_note=$style_note trophy3 |
12286 | obado | 51 | !endif |
13167 | bpr | 52 | !if $t0_>=9 and $t0_<9.5 |
12342 | bpr | 53 | !set style_note=$style_note trophy2 |
54 | !endif |
||
13167 | bpr | 55 | !if $t0_>=8 and $t0_<9 |
12342 | bpr | 56 | !set style_note=$style_note trophy1 |
57 | !endif |
||
12286 | obado | 58 | !set style_note=$style_note" |
7943 | bpr | 59 | !exit |
60 | :livret |
||
61 | |||
12264 | bpr | 62 | !let t_=!charcnt $t0_ |
63 | !if $t_>1 or ($t_=1 and $t0_>0) |
||
1953 | guerimand | 64 | !let t_=$t0_+0.0000001 |
12264 | bpr | 65 | !else |
1953 | guerimand | 66 | !let t_=0 |
12264 | bpr | 67 | !endif |
12440 | guerimand | 68 | |
12264 | bpr | 69 | !set style_note="background-color:$(wims_scorecolor[$[ceil(min($t_,10))+1]]);" |
7943 | bpr | 70 | |
71 | !! approximation of score in case of livret : |
||
12482 | guerimand | 72 | !set value_note=$[rint(($t0_)*10^(max(0,$wims_scoreview)))/10^(max(0,$wims_scoreview))] |
12264 | bpr | 73 | !if $wims_scoreview>=0 and $t_>0 |
12440 | guerimand | 74 | !set output_note=$value_note |
12264 | bpr | 75 | !else |
76 | !set output_note= |
||
77 | !endif |
||
12440 | guerimand | 78 | !if $t_=0 |
79 | !set value_note=-1 |
||
80 | !endif |
||
12274 | bpr | 81 | !exit |
82 | |||
83 | :legend |
||
12283 | bpr | 84 | !set output_legend=<fieldset class="wims_score_bar_legend">\ |
85 | <legend>$wims_name_legend</legend><ul>\ |
||
12399 | bpr | 86 | <li style="background-color:$(class_scorecolor[12])"> </li> |
12274 | bpr | 87 | !for j=0 to 10 |
12379 | obado | 88 | !set output_legend=$output_legend<li style="background-color:$(class_scorecolor[$j+1])">$j</li> |
12274 | bpr | 89 | !next |
12278 | obado | 90 | !set output_legend=$output_legend</ul></fieldset> |