Rev 7582 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
7566 | schaersvoo | 1 | !default num_svg_images=1 |
2 | !default xsize = 300 |
||
3 | !default ysize = 300 |
||
4 | !default num_x = 10 |
||
5 | !default num_y = 10 |
||
7582 | schaersvoo | 6 | !default svg_click_colors = #ff0000,#0000ff,#00ff00 |
7 | !default svg_bg_color = #ffffff |
||
7566 | schaersvoo | 8 | !default svg_interactive = 1 |
9 | !default fill_opacity = 1 |
||
10 | !default stroke_opacity = 0.8 |
||
11 | !default svg_linewidth = 1 |
||
7582 | schaersvoo | 12 | !default stroke_color = grey |
7566 | schaersvoo | 13 | !! set of coordinates in Quadrant I (fig_x:fig_y) fig_x --> 0...num_x fig_y -->0...num_y with colors from fig_color array |
14 | !! fig_x = '1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5,1,2,3,4,5' |
||
15 | !! fig_y = '1,1,1,1,1,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5' |
||
16 | !! all data will be mapped to integer 5.9 -> 5 !! |
||
17 | !! this image will be protected from user clicks |
||
18 | !default fig_x = null |
||
19 | !default fig_y = null |
||
7582 | schaersvoo | 20 | !default fig_color = #FF0000 |
7566 | schaersvoo | 21 | !! optional add objects: circle(s), line(s) or polyline; all coordinates are in px; not in 'QI grid' |
22 | !! these objects are static; can not be (re)moved and will not be read by read_svg() |
||
23 | !! circle (x,y,r in px) is js.array: 9 elements per circle ['xc_1','yc_1','r_1','linewidth_1','strokecolor_1','strokeopacity_1','filled_1','fillcolor_1','fillopacity_1',...] |
||
24 | !! line is (x,y in px) array: 7 elements per line [ 'x1_1','y1_1','x2_1','y2_1','linewidth_1','strokecolor_1','strokeopacity_1'] |
||
25 | !! poly : just one poly allowed 6 elements and x/y pairs in px ['linewidth','strokecolor','strokeopacity','filled','fillcolor',fillopacity','x_1','y_1',...,'x_n','y_n'] |
||
7499 | schaersvoo | 26 | |
12523 | schaersvoo | 27 | <script> |
7566 | schaersvoo | 28 | "use strict"; |
7499 | schaersvoo | 29 | var descr_list="$description"; |
7567 | schaersvoo | 30 | var description = make_description(descr_list,30); |
7566 | schaersvoo | 31 | |
7502 | schaersvoo | 32 | function dontknow(){ |
33 | var reply = new Array() |
||
7560 | schaersvoo | 34 | reply[0] = read_svg(); |
35 | for( var p = 1 ; p <= $inputs; p++){ |
||
7502 | schaersvoo | 36 | reply[p] = "?"; |
37 | } |
||
38 | myConfirm('$dontknow',reply,'$wims_ref_name','$session','$module','$counter','$nok_send_color'); |
||
7566 | schaersvoo | 39 | return; |
7502 | schaersvoo | 40 | } |
7566 | schaersvoo | 41 | |
7499 | schaersvoo | 42 | function sendanswer(){ |
43 | var reply = new Array(); |
||
7560 | schaersvoo | 44 | reply[0] = read_svg(); |
7499 | schaersvoo | 45 | var p = 0; |
46 | if( document.getElementById('myinput0')){ |
||
7502 | schaersvoo | 47 | while( document.getElementById('myinput'+p) ){ |
7560 | schaersvoo | 48 | reply[p+1] = document.getElementById('myinput'+p).value; |
7502 | schaersvoo | 49 | p++; |
50 | } |
||
7499 | schaersvoo | 51 | } |
7502 | schaersvoo | 52 | myConfirm('$send ?',reply,'$wims_ref_name','$session','$module','$counter','$ok_send_color'); |
7566 | schaersvoo | 53 | return; |
7497 | schaersvoo | 54 | } |
7566 | schaersvoo | 55 | |
7497 | schaersvoo | 56 | !if $wims_user=supervisor |
7499 | schaersvoo | 57 | function putanswer(){ |
7497 | schaersvoo | 58 | !set wims_answer = !words2items $(answer$n) |
59 | !set num_answers = !itemcnt $wims_answer |
||
7499 | schaersvoo | 60 | var answer = make_description("$wims_answer",$num_answers); |
61 | for(var p=0;p<answer.length;p++){ |
||
62 | document.getElementById('myinput'+p).value = answer[p]; |
||
63 | } |
||
7497 | schaersvoo | 64 | } |
65 | !endif |
||
7566 | schaersvoo | 66 | |
67 | function color2hex(color_array){ |
||
68 | var rgb2txt = {"aliceblue": "#f0f8ff", "antiquewhite": "#faebd7", "aqua": "#00ffff", "aquamarine": "#7fffd4", "azure": "#f0ffff", "beige": "#f5f5dc", "bisque": "#ffe4c4", "black": "#000000", "blanchedalmond": "#ffebcd", "blue": "#0000ff", "blueviolet": "#8a2be2", "brown": "#a52a2a", "burlywood": "#deb887", "cadetblue": "#5f9ea0", "chartreuse": "#7fff00", "chocolate": "#d2691e", "coral": "#ff7f50", "cornflowerblue": "#6495ed", "cornsilk": "#fff8dc", "crimson": "#dc143c", "cyan": "#00ffff", "darkblue": "#00008b", "darkcyan": "#008b8b", "darkgoldenrod": "#b8860b", "darkgray": "#a9a9a9", "darkgreen": "#006400", "darkkhaki": "#bdb76b", "darkmagenta": "#8b008b", "darkolivegreen": "#556b2f", "darkorange": "#ff8c00", "darkorchid": "#9932cc", "darkred": "#8b0000", "darksalmon": "#e9967a", "darkseagreen": "#8fbc8f", "darkslateblue": "#483d8b", "darkslategray": "#2f4f4f", "darkturquoise": "#00ced1", "darkviolet": "#9400d3", "deeppink": "#ff1493", "deepskyblue": "#00bfff", "dimgray": "#696969", "dodgerblue": "#1e90ff", "firebrick": "#b22222", "floralwhite": "#fffaf0", "forestgreen": "#228b22", "fuchsia": "#ff00ff", "gainsboro": "#dcdcdc", "ghostwhite": "#f8f8ff", "gold": "#ffd700", "goldenrod": "#daa520", "gray": "#808080", "green": "#008000", "greenyellow": "#adff2f", "honeydew": "#f0fff0", "hotpink": "#ff69b4", "indianred ": "#cd5c5c", "indigo ": "#4b0082", "ivory": "#fffff0", "khaki": "#f0e68c", "lavender": "#e6e6fa", "lavenderblush": "#fff0f5", "lawngreen": "#7cfc00", "lemonchiffon": "#fffacd", "lightblue": "#add8e6", "lightcoral": "#f08080", "lightcyan": "#e0ffff", "lightgoldenrodyellow": "#fafad2", "lightgrey": "#d3d3d3", "lightgreen": "#90ee90", "lightpink": "#ffb6c1", "lightsalmon": "#ffa07a", "lightseagreen": "#20b2aa", "lightskyblue": "#87cefa", "lightslategray": "#778899", "lightsteelblue": "#b0c4de", "lightyellow": "#ffffe0", "lime": "#00ff00", "limegreen": "#32cd32", "linen": "#faf0e6", "magenta": "#ff00ff", "maroon": "#800000", "mediumaquamarine": "#66cdaa", "mediumblue": "#0000cd", "mediumorchid": "#ba55d3", "mediumpurple": "#9370d8", "mediumseagreen": "#3cb371", "mediumslateblue": "#7b68ee", "mediumspringgreen": "#00fa9a", "mediumturquoise": "#48d1cc", "mediumvioletred": "#c71585", "midnightblue": "#191970", "mintcream": "#f5fffa", "mistyrose": "#ffe4e1", "moccasin": "#ffe4b5", "navajowhite": "#ffdead", "navy": "#000080", "oldlace": "#fdf5e6", "olive": "#808000", "olivedrab": "#6b8e23", "orange": "#ffa500", "orangered": "#ff4500", "orchid": "#da70d6", "palegoldenrod": "#eee8aa", "palegreen": "#98fb98", "paleturquoise": "#afeeee", "palevioletred": "#d87093", "papayawhip": "#ffefd5", "peachpuff": "#ffdab9", "peru": "#cd853f", "pink": "#ffc0cb", "plum": "#dda0dd", "powderblue": "#b0e0e6", "purple": "#800080", "red": "#ff0000", "rosybrown": "#bc8f8f", "royalblue": "#4169e1", "saddlebrown": "#8b4513", "salmon": "#fa8072", "sandybrown": "#f4a460", "seagreen": "#2e8b57", "seashell": "#fff5ee", "sienna": "#a0522d", "silver": "#c0c0c0", "skyblue": "#87ceeb", "slateblue": "#6a5acd", "slategray": "#708090", "snow": "#fffafa", "springgreen": "#00ff7f", "steelblue": "#4682b4", "tan": "#d2b48c", "teal": "#008080", "thistle": "#d8bfd8", "tomato": "#ff6347", "turquoise": "#40e0d0", "violet": "#ee82ee", "wheat": "#f5deb3", "white": "#ffffff", "whitesmoke": "#f5f5f5", "yellow": "#ffff00", "yellowgreen": "#9acd32", "darkgrey": "#a9a9a9", "darkslategrey": "#2f4f4f", "dimgrey": "#696969", "grey": "#808080", "lightgray": "#d3d3d3", "lightslategrey": "#778899", "slategrey": "#708090"}; |
||
69 | var lx = color_array.length; |
||
70 | for(var i = 0 ; i < lx ; i++ ){ |
||
71 | if( rgb2txt[color_array[i].toLowerCase()] !== undefined ){ |
||
72 | color_array[i] = rgb2txt[color_array[i].toLowerCase()]; |
||
73 | } |
||
74 | } |
||
75 | return color_array; |
||
76 | } |
||
77 | |||
78 | function svg_mouse(action,myid,img){ |
||
79 | try{action.preventDefault;action.stopPropagation();} catch(e){} |
||
80 | if( action.which != 1 ){ img.coloridx++;} |
||
7582 | schaersvoo | 81 | if( img.coloridx >= img.svg_click_colors.length ){ img.coloridx = 0; } |
7566 | schaersvoo | 82 | try{ |
83 | var obj = document.getElementById(myid); |
||
84 | obj.setAttributeNS(null,"fill",img.svg_click_colors[img.coloridx]); |
||
85 | }catch(e){setAlarm(e);} |
||
86 | } |
||
87 | |||
88 | function svg_image(id,xsize,ysize,num_x,num_y,svg_click_colors,svg_bg_color,svg_interactive,fig_x,fig_y,fig_color,fill_opacity,stroke_opacity,svg_linewidth,stroke_color,circle,line,polyline){ |
||
89 | this.circle = circle || null; |
||
90 | this.line = line || null; |
||
91 | this.polyline = polyline || null; |
||
92 | this.svg_id = 'wims_svg'+id || 'wims_svg0'; |
||
93 | this.xsize = xsize || 300; |
||
94 | this.ysize = ysize || 300; |
||
95 | this.num_x = num_x || 10; |
||
96 | this.num_y = num_y || 10; |
||
97 | this.w = this.xsize / this.num_x; |
||
98 | this.h = this.ysize / this.num_y; |
||
99 | this.svg_click_colors = color2hex(svg_click_colors.split(',')) || ['#FF0000','#0000FF']; |
||
100 | this.svg_bg_color = svg_bg_color.toString() || '#0000FF'; |
||
101 | this.svg_click_colors[this.svg_click_colors.length] = this.svg_bg_color; /* add bgcolor to click array */ |
||
102 | this.svg_interactive = svg_interactive || 1; |
||
103 | this.fig_x = fig_x || null; /* integer array of x-coordinates of unchangable rects */ |
||
104 | this.fig_y = fig_y || null; /* integer array of y-coordinates of unchangable rects */ |
||
105 | if(this.fig_x != null){ |
||
106 | this.fig_x = (this.fig_x).split(',').map(function(i){return parseInt(i, 10);}); |
||
107 | this.fig_y = (this.fig_y).split(',').map(function(i){return parseInt(i, 10);}); |
||
108 | } |
||
109 | this.fig_color = color2hex(fig_color.split(',')) || ['#FFFFFF']; /* color array of prefined object */ |
||
110 | this.fill_opacity = fill_opacity || 1; |
||
111 | this.stroke_opacity = stroke_opacity || 1; |
||
112 | this.svg_linewidth = svg_linewidth || 1; |
||
113 | this.stroke_color = stroke_color || '#FFFFFF'; /* color of the grid lines */ |
||
114 | this.coloridx = 0; |
||
115 | var wims_svg = document.getElementById(this.svg_id); |
||
116 | var data = (wims_svg.getAttribute("viewBox")).split(' '); |
||
117 | var sizex = data[2] - data[0]; |
||
118 | var sizey = data[3] - data[1]; |
||
119 | var idx=0; |
||
120 | var rect_id; |
||
121 | var found = 0; |
||
122 | var lx = 0; |
||
123 | if(this.fig_x != null){ |
||
124 | lx = (this.fig_x).length; |
||
125 | if( lx != (this.fig_y).length ){ alert("mismatch between \"fig_x\" and \"fig_y\" !" );} |
||
126 | var lc = (this.fig_color).length |
||
127 | if( lx > lc ){ |
||
128 | for(var p = lc; p < lx ; p++){ |
||
129 | this.fig_color[p] = this.fig_color[0]; /* use the first color in array repetitively if needed */ |
||
130 | } |
||
131 | } |
||
132 | } |
||
133 | for(var y = 0 ; y < this.num_y ; y++){ |
||
134 | for(var x = 0 ; x < this.num_x ; x++){ |
||
135 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); |
||
136 | rect_id = this.svg_id+"_"+idx; |
||
137 | rect.setAttributeNS(null,"width",this.w); |
||
138 | rect.setAttributeNS(null,"height",this.h); |
||
139 | rect.setAttributeNS(null,"stroke-width",this.svg_linewidth); |
||
140 | rect.setAttributeNS(null,"id",rect_id); |
||
141 | rect.setAttributeNS(null,"x",x*this.w); |
||
142 | rect.setAttributeNS(null,"y",y*this.h); |
||
143 | rect.setAttributeNS(null,"stroke",this.stroke_color); |
||
144 | rect.setAttributeNS(null,"stroke-opacity",this.stroke_opacity); |
||
145 | rect.setAttributeNS(null,"fill-opacity",this.fill_opacity); |
||
7582 | schaersvoo | 146 | found = 0; |
7566 | schaersvoo | 147 | if( this.fig_x != null){ /* create proctected squares from arrays fig_x / fig_y */ |
148 | for(var fx = 0; fx < lx && found == 0 ; fx++){ |
||
149 | if(this.fig_x[fx] == x+1 && this.fig_y[fx] == this.num_y - y ){ /* data all in Quadrant I ... */ |
||
150 | rect.setAttributeNS(null,"fill",this.fig_color[fx]); |
||
151 | found = 1; |
||
152 | } |
||
153 | } |
||
154 | } |
||
155 | if( found == 0 ){ |
||
156 | rect.setAttributeNS(null,"fill",this.svg_bg_color ); |
||
7582 | schaersvoo | 157 | !! if("waiting" == "$status" || this.svg_interactive == 1 ){ |
158 | if(this.svg_interactive == 1 ){ |
||
7566 | schaersvoo | 159 | (function(rect_id){ |
160 | rect.addEventListener("mousedown", function(action){ |
||
161 | svg_mouse(action,rect_id,eval('image'+id));}, false); |
||
162 | }(rect_id)); |
||
163 | } |
||
164 | } |
||
165 | wims_svg.appendChild(rect); |
||
166 | idx++; |
||
167 | } |
||
168 | } |
||
169 | |||
170 | if(this.circle != null){ |
||
171 | /* |
||
172 | circle (x,y,r in px) is js.array: 9 elements per circle |
||
173 | ['xc_1','yc_1','r_1','linewidth_1','strokecolor_1','strokeopacity_1','filled_1','fillcolor_1','fillopacity_1',...] |
||
174 | */ |
||
175 | var len = (this.circle).length; |
||
176 | for(var p = 0 ; p < len; p = p + 9){ |
||
177 | var circle = document.createElementNS("http://www.w3.org/2000/svg", "circle"); |
||
178 | circle.setAttributeNS(null,"cx",this.circle[p]); |
||
179 | circle.setAttributeNS(null,"cy",this.circle[p+1]); |
||
180 | circle.setAttributeNS(null,"r",this.circle[p+2]); |
||
181 | circle.setAttributeNS(null,"stroke-width",this.circle[p+3]); |
||
182 | circle.setAttributeNS(null,"stroke",this.circle[p+4]); |
||
183 | circle.setAttributeNS(null,"stroke-opacity",this.circle[p+5]); |
||
184 | if( this.circle[p+6] == 1 ){ |
||
185 | circle.setAttributeNS(null,"fill",this.circle[p+7]); |
||
186 | circle.setAttributeNS(null,"fill-opacity",this.circle[p+8]); |
||
187 | } |
||
188 | wims_svg.appendChild(circle); |
||
189 | } |
||
190 | } |
||
191 | if(this.line != null){ |
||
192 | /* |
||
193 | line is (x,y in px) array: 7 elements per line |
||
194 | [ 'x1_1','y1_1','x2_1','y2_1','linewidth_1','strokecolor_1','strokeopacity_1'] |
||
195 | */ |
||
196 | var len = (this.line).length; |
||
197 | for(var p = 0 ; p < len; p = p + 7){ |
||
198 | var line = document.createElementNS("http://www.w3.org/2000/svg", "line"); |
||
199 | line.setAttributeNS(null,"x1",this.line[p]); |
||
200 | line.setAttributeNS(null,"y1",this.line[p+1]); |
||
201 | line.setAttributeNS(null,"x2",this.line[p+2]); |
||
202 | line.setAttributeNS(null,"y2",this.line[p+3]); |
||
203 | line.setAttributeNS(null,"stroke-width",this.line[p+4]); |
||
204 | line.setAttributeNS(null,"stroke",this.line[p+5]); |
||
205 | line.setAttributeNS(null,"stroke-opacity",this.line[p+6]); |
||
206 | wims_svg.appendChild(line); |
||
207 | } |
||
208 | } |
||
209 | if(this.polyline != null){ |
||
210 | /* |
||
211 | poly : just one poly allowed 6 elements and x/y pairs in px |
||
212 | ['linewidth','strokecolor','strokeopacity','filled','fillcolor',fillopacity','x_1','y_1',...,'x_n','y_n'] |
||
213 | */ |
||
214 | var len = (this.polyline).length; |
||
215 | var points = (this.polyline).splice(6,len); |
||
216 | var polyline = document.createElementNS("http://www.w3.org/2000/svg", "polyline"); |
||
217 | polyline.setAttributeNS(null,"stroke-width",this.polyline[0]); |
||
218 | polyline.setAttributeNS(null,"stroke",this.polyline[1]); |
||
219 | polyline.setAttributeNS(null,"stroke-opacity",this.polyline[2]); |
||
220 | polyline.setAttributeNS(null,"points",points); |
||
221 | if(this.polyline[3] == 1 ){ |
||
222 | polyline.setAttributeNS(null,"fill",this.polyline[4]); |
||
223 | polyline.setAttributeNS(null,"fill-opacity",this.polyline[5]); |
||
224 | } |
||
225 | wims_svg.appendChild(polyline); |
||
226 | } |
||
227 | } |
||
228 | /* read all svg_images e.g. num_svg_images */ |
||
229 | !if $roosterapplet=0 |
||
230 | function read_svg(){ |
||
231 | /* clicktile.jar ; vervanging ReadXY();*/ |
||
232 | var total_reply = new Array($num_svg_images); |
||
233 | for(var img=0; img<$num_svg_images;img++){ |
||
234 | if( document.getElementById("wims_svg"+img).interactive == 1 ){ /* only read interactive svg images*/ |
||
235 | var idx = 0; |
||
236 | var tmp_idx = 0; |
||
237 | tmp_reply=new Array(); |
||
238 | var svgimg = eval('image'+img); |
||
239 | while( document.getElementById("wims_svg"+img+"_"+idx)){ |
||
240 | obj = document.getElementById("wims_svg"+img+"_"+idx); |
||
241 | color = obj.getAttributeNS(null,"fill"); |
||
242 | if( color != svgimg.svg_bg_color ){/* e.g. colour is changed */ |
||
243 | tmp_reply[tmp_idx] = obj.getAttributeNS(null,"x") / this.w+","+obj.getAttributeNS(null,"y") / this.h; |
||
244 | tmp_idx++; |
||
245 | } |
||
246 | idx++; |
||
247 | } |
||
248 | total_reply[img]=tmp_reply+"\n"; |
||
249 | } |
||
250 | } |
||
251 | } |
||
252 | !else |
||
253 | function read_svg(){ |
||
254 | /* rooster.jar vervanging String S=total_aantal+","+onveranderd_aantal+","+veranderd_aantal+","+omtrek_van_geklikte_ruitjes;*/ |
||
255 | var total_reply = new Array($num_svg_images); |
||
256 | for(var img=0; img<$num_svg_images;img++){ |
||
257 | var svgimg = eval('image'+img); |
||
258 | var x;var y;var click_reply=new Array(4);var obj;var color;var myid; |
||
259 | var xc = new Array();var yc = new Array();var cc = new Array(); |
||
260 | var idx = 0; |
||
261 | var width = svgimg.xsize / svgimg.num_x; |
||
262 | var height = svgimg.ysize / svgimg.num_y |
||
263 | click_reply[1] = 0; /* unchanged */ |
||
264 | click_reply[2] = 0; /* changed */ |
||
265 | click_reply[3] = 0; /* total perimeter of changed rects */ |
||
266 | while( document.getElementById("wims_svg"+img+"_"+idx)){ |
||
267 | obj = document.getElementById("wims_svg"+img+"_"+idx); |
||
268 | x = obj.getAttributeNS(null,"x"); |
||
269 | y = obj.getAttributeNS(null,"y"); |
||
270 | xc[idx] = x/width; |
||
271 | yc[idx] = y/height; |
||
272 | color = obj.getAttributeNS(null,"fill"); |
||
273 | if( color != svgimg.svg_bg_color ){/* e.g. colour is changed */ |
||
274 | click_reply[2] = click_reply[2]+1;cc[idx] = 1; |
||
275 | } |
||
276 | else |
||
277 | { |
||
278 | click_reply[1]=click_reply[1]+1;cc[idx] = 0; |
||
279 | } |
||
280 | idx++; |
||
281 | } |
||
282 | click_reply[0] = idx; /* sum */ |
||
283 | /* correct perimetre if size of rectangle != 1x1 */ |
||
284 | var fx;var fy;if( width < height ){ fx = 1 ; fy = height / width;} else { fx = width / height;fy = 1; } |
||
285 | click_reply[3] = click_reply[2] * (2*fy + 2*fx);/* max perimetre */ |
||
286 | if( click_reply[2] > 1 ){ |
||
287 | for( var i=0 ; i < idx ; i++){ |
||
288 | if( cc[i] == 1 ){ /* clicked */ |
||
289 | for( var p=0; p < idx ; p++){ /* look for neighbours */ |
||
290 | if( cc[p] == 1 && p != i){ /* do not count the same rect */ |
||
291 | if( xc[i] == xc[p] && yc[i] == yc[p] - 1 ){ click_reply[3] = click_reply[3] - fx;} |
||
292 | else |
||
293 | if( xc[i] == xc[p] && yc[i] == yc[p] + 1 ){ click_reply[3] = click_reply[3] - fx;} |
||
294 | else |
||
295 | if( xc[i] == xc[p] - 1 && yc[i] == yc[p] ){ click_reply[3] = click_reply[3] - fy;} |
||
296 | else |
||
297 | if( xc[i] == xc[p] + 1 && yc[i] == yc[p] ){ click_reply[3] = click_reply[3] - fy;} |
||
298 | } |
||
299 | } |
||
300 | } |
||
301 | } |
||
302 | } |
||
303 | total_reply[img] = click_reply+"\n"; |
||
304 | } |
||
305 | return total_reply; |
||
306 | } |
||
307 | !endif |
||
308 | !endif |
||
7497 | schaersvoo | 309 | </script> |
7566 | schaersvoo | 310 | |
311 | |||
7502 | schaersvoo | 312 | <table id="exercise" class="exercise" > |
7497 | schaersvoo | 313 | <tr> |
314 | <td class="exercise_m"> |
||
315 | !if $(question$n) != $empty |
||
316 | $(question$n) |
||
317 | !endif |
||
318 | !if $exotext != $empty |
||
319 | <br /> |
||
320 | $exotext |
||
321 | !endif |
||
322 | !if $inputs > 0 |
||
323 | <table class="exercise"> |
||
324 | !for p=1 to $inputs |
||
325 | <tr> |
||
326 | <td class="exercise_c"> |
||
7499 | schaersvoo | 327 | $(description[$p]) |
7497 | schaersvoo | 328 | </td> |
329 | <td class="exercise_c"> |
||
330 | $m_rightarrow |
||
331 | </td> |
||
332 | <td class="exercise_c"> |
||
7499 | schaersvoo | 333 | <input class="schaersvoorde_input" size="$cols" type="text" id="myinput$[$p-1]" value="" /> $(ex$p) |
7497 | schaersvoo | 334 | </td> |
335 | </tr> |
||
336 | !next p |
||
337 | </table> |
||
338 | !endif |
||
339 | </td> |
||
340 | !if $make_tr=1 |
||
341 | </tr> |
||
342 | <tr> |
||
343 | !endif |
||
7566 | schaersvoo | 344 | !for id=0 to $[$num_svg_images-1] |
345 | !! id = wims_svg$id |
||
346 | <td class="exercise_c" id="svg_td$id" > |
||
7497 | schaersvoo | 347 | <svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" id="wims_svg$id" width="$xsize" height="$ysize" viewBox="0 0 $xsize $ysize" > |
348 | <g id="svg_transform$id" transform="scale(1)" > |
||
7566 | schaersvoo | 349 | <image preserveAspectRatio="none" xlink:href="$svg_bgimage" x="0" y="0" height="100%" width="100%"></image> |
12523 | schaersvoo | 350 | <script> |
7566 | schaersvoo | 351 | !! var image$id = new svg_image($id,$xsize,$ysize,$num_x,$num_y,$svg_click_colors,$svg_bg_color,$svg_interactive,$fig_x,$fig_y,$fig_color,$fill_opacity,$stroke_opacity,$svg_linewidth,$stroke_color,$circle,$line,$polyline); |
7582 | schaersvoo | 352 | var image$id = new svg_image('$id','$xsize','$ysize','$num_x','$num_y','$svg_click_colors','$svg_bg_color','$svg_interactive','$fig_x','$fig_y','$fig_color','$fill_opacity','$stroke_opacity','$svg_linewidth','$stroke_color'); |
7497 | schaersvoo | 353 | </script> |
354 | </g> |
||
355 | </svg> |
||
356 | </td> |
||
7566 | schaersvoo | 357 | !next id |
7497 | schaersvoo | 358 | </tr> |
359 | </table> |
||
360 | <div id="send_buttons" class="embedded_central"> |
||
361 | <input type="button" id="schaersvoorde_ok_button" onclick="javascript:sendanswer();" value="$send" /> |
||
362 | <input type="button" id="schaersvoorde_nok_button" onclick="javascript:dontknow();" value="$dontknow" /> |
||
363 | !if $wims_user=supervisor |
||
364 | <input type="button" id="schaersvoorde_extra_button" onclick="javascript:putanswer();" value="$wims_firstname $wims_lastname" /> |
||
365 | !endif |
||
366 | </div> |
||
367 | |||
7566 | schaersvoo | 368 | !exit |