Rev 15753 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
217 | bpr | 1 | |
2 | sec=!defof class_secure in wimshome/log/classes/$wims_class/.def |
||
3 | sec=!trim $sec |
||
4 | htest=!checkhost $sec |
||
5 | !if $wims_sup_secure<0 or ($sec!=$empty and $htest<1) |
||
12479 | bpr | 6 | error=not_secure |
7 | !exit |
||
217 | bpr | 8 | !endif |
9 | |||
10 | !!typename=!defof class_typename in wimshome/log/classes/$wims_class/.def |
||
11 | !!classtype=!defof class_type in wimshome/log/classes/$wims_class/.def |
||
12 | |||
13 | !bound csvformat within xls,csv,tsv default xls |
||
14 | !if $csvtype!=download |
||
12479 | bpr | 15 | !exit |
217 | bpr | 16 | !endif |
17 | !if $vote>0 |
||
18 | parmcnt=0 |
||
19 | !read $votedir/$vote.def |
||
12479 | bpr | 20 | quote=" |
21 | sep_csv=; |
||
22 | sep_xls=; |
||
23 | sep_tsv=$ $ |
||
24 | sep=$(sep_$csvformat) |
||
25 | !default sep=$(sep_xls) |
||
26 | fbase=data-$wims_class-vote-$vote |
||
27 | fbase=!translate internal / to _ in $fbase |
||
28 | fname=wimshome/$wims_sesdir/spreadsheet.$csvformat |
||
7198 | bpr | 29 | |
12479 | bpr | 30 | tit="$title_vote $vote" |
31 | !writefile $fname $tit\ |
||
7198 | bpr | 32 | |
12479 | bpr | 33 | !readdef $votedir/$vote.votes |
34 | !readdef $votedir/$vote.comments |
||
217 | bpr | 35 | |
12479 | bpr | 36 | !if $vote_option=anonymous or $csvoption=global |
37 | ### en ligne les questions, en colonne le nombre de votants pour chaque réponse |
||
38 | tableau= |
||
39 | maxchoice=1 |
||
40 | !for t = 1 to $parmcnt |
||
41 | maxchoice=$[max($maxchoice, $(choices$t))] |
||
42 | line=Q.$t _ |
||
43 | !if $(type_comment$t)!=yes |
||
44 | !for r = 0 to $[$(choices$t)] |
||
45 | line=!append item _ $(vcnt_$(t)_$(r)) _ to $line |
||
46 | !next |
||
47 | !endif |
||
48 | tableau =!append line $line to $tableau |
||
49 | prel=!makelist _ $name_choice x _ for x = 0 to $maxchoice |
||
50 | !next |
||
51 | tableau=_,$prel\ |
||
217 | bpr | 52 | $tableau |
12479 | bpr | 53 | !goto end |
54 | !endif |
||
55 | !if $vote_option=trace |
||
56 | tableau=!makelist x for x = 1 to $vcnt |
||
57 | tableau=!replace internal , by ; in $tableau |
||
58 | tableau=!rows2lines $tableau |
||
59 | line=!makelist _0_ for x=1 to $parmcnt |
||
217 | bpr | 60 | !for u = 1 to $vcnt |
12479 | bpr | 61 | tableau=!replace line number $u by "$u"_,_$line in $tableau |
217 | bpr | 62 | !next |
12479 | bpr | 63 | !for t = 1 to $parmcnt |
64 | !if $(type_comment$t)!=yes |
||
65 | !for l = 0 to $[$(choices$t)] |
||
66 | v=$(votes_$(t)_$l) |
||
67 | v1=!itemcnt $v |
||
68 | !if $v1>0 |
||
69 | !for h = 1 to $v1 |
||
70 | line=!line $(v[$h]) of $tableau |
||
71 | line=!replace item number $[$t+1] by _$(l)_ in $line |
||
72 | tableau=!replace internal line number $(v[$h]) by $line in $tableau |
||
73 | !next |
||
74 | !endif |
||
75 | !next |
||
76 | !else |
||
77 | cnt_prov=!itemcnt $(comment_$(t)) |
||
78 | !for u = 1 to $vcnt |
||
79 | line=!line $u of $tableau |
||
80 | ### changement de format - transitoire |
||
81 | !if $u <= $cnt_prov |
||
82 | c=!declosing $(comment_$(t)[$u]) |
||
83 | !else |
||
84 | uprov=$[$u-$cnt_prov] |
||
85 | c=!record $uprov of $votedir/$(vote)_$t.comments |
||
86 | !endif |
||
87 | c=!replace internal ; by -- in $c |
||
88 | c=!replace internal , by - in $c |
||
15753 | bpr | 89 | c=!replace internal $joker by $ $ in $c |
12479 | bpr | 90 | line=!replace item number $[$t+1] by _$c _ in $line |
91 | tableau=!replace internal line number $u by $line in $tableau |
||
92 | !next |
||
93 | !endif |
||
94 | !next |
||
95 | entete= !makelist _ Q.x _ for x=1 to $parmcnt |
||
96 | tableau=_,$entete\ |
||
97 | $tableau |
||
217 | bpr | 98 | !endif |
99 | |||
12479 | bpr | 100 | !if $vote_option=nominative |
101 | tableau=!makelist x for x = 1 to $vcnt |
||
102 | tableau=!replace internal , by ; in $tableau |
||
103 | tableau=!rows2lines $tableau |
||
104 | line=!makelist _0_ for x=1 to $parmcnt |
||
105 | !for u = 1 to $vcnt |
||
106 | tableau=!replace line number $u by "$u"_,_$line in $tableau |
||
107 | !next |
||
108 | cmp=0 |
||
109 | !for t = 1 to $parmcnt |
||
110 | !if $(type_comment$t)!=yes |
||
111 | !for l = 0 to $[$(choices$t)] |
||
112 | v=$(votes_$(t)_$l) |
||
113 | v1=!itemcnt $v |
||
114 | !if $v1>0 |
||
115 | !for h = 1 to $v1 |
||
116 | !if supervisor/ notin $(v[$h])/ |
||
117 | u=!replace internal / by _ in $(v[$h]) |
||
118 | u=!replace internal @ by ___ in $u |
||
119 | !if $(cnt_$u)= |
||
120 | cmp=$[$cmp+1] |
||
121 | cnt_$u=$cmp |
||
122 | item1=$u |
||
123 | !endif |
||
124 | line=!line $(cnt_$u) of $tableau |
||
125 | line=!replace item number 1 by $(v[$h])_ in $line |
||
126 | line=!replace item number $[$t+1] by _$(l)_ in $line |
||
127 | tableau=!replace internal line number $(cnt_$u) by $line in $tableau |
||
128 | !endif |
||
129 | !next |
||
130 | !endif |
||
131 | !next |
||
217 | bpr | 132 | !endif |
12479 | bpr | 133 | !next |
134 | entete= !makelist _ Q.x _ for x=1 to $parmcnt |
||
135 | tableau=_,$entete\ |
||
136 | $tableau |
||
137 | !goto end |
||
138 | !endif |
||
7198 | bpr | 139 | |
12479 | bpr | 140 | :end |
141 | tableau=!replace internal _,_ by $sep in $tableau |
||
142 | !! !! the following messes up with username containing _ |
||
143 | !! !! testing! |
||
15871 | bpr | 144 | tableau=!replace internal _" by " in $tableau |
12479 | bpr | 145 | tableau=!replace internal --- by in $tableau |
7198 | bpr | 146 | |
12479 | bpr | 147 | !appendfile $fname $tableau |
217 | bpr | 148 | |
12479 | bpr | 149 | infile=spreadsheet.$csvformat |
150 | outfile=$fbase.$csvformat |
||
151 | !mexec csv/getprep.sh |
||
217 | bpr | 152 | !endif |
153 | |||
154 | !reset csvtype |