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