1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
!set ans_require=jsxgraph
!set wims_form_method=post
!set anstype=yes
!set anstyle=dprompt
!if $wims_read_parm=def
!exit
!endif
!if $printing=yes
!set i=$wims_read_parm
!set id=$(iii)_$i
!else
!set id=$i
!endif
!set oef_answer_option$i=!replace internal $ $ by $\
$ in $inputsize
!set variable=!line -1 of $(oef_answer_option$i)
!set oef_answer_option$i=!line 1 to -2 of $(oef_answer_option$i)
!set oef_answer_option$i=!nonempty lines $(oef_answer_option$i)
!set Inputsize=!line 1 of $(oef_answer_option$i)
!set test=!text remove 0123456789x in $Inputsize
!if $test issametext $empty
!set Inputsize=!replace internal x by , in $Inputsize
!set oef_answer_option$i=!line 2 to -1 of $(oef_answer_option$i)
!set oef_answer_option$i=!declosing $(oef_answer_option$i)
!distribute items $Inputsize into xsize,ysize
!endif
!set jbox=!line 1 of $(oef_answer_option$i)
!if responsive isin $jbox
!set responsive=yes
!set pos1=!positionof char [ in $jbox
!set pos2=!positionof char ] in $jbox
!set jbox_option_= !char $pos1 to $pos2 of $jbox
!set jbox_option_=!replace internal responsive by in $jbox_option_
!set jbox_option_=!declosing $jbox_option_
!set jbox=!char 1 to $[$pos1-1] of $jbox
!endif
!set your_brd=!word 2 of $jbox
!set jbox=!word 1 of $jbox
!default your_brd=brd$id
!set oef_answer_option$i=!line 2 to -1 of $(oef_answer_option$i)
!set script$i=$(oef_answer_option$i)
!set variable=!replace internal ; by $\
$ in $variable
!set cnt_var=!linecnt $variable
!reset liste_variable
!reset liste_dim
!for j_ = 1 to $cnt_var
!set l_=!line $j_ of $variable
!set l_=!replace internal = by , in $l_
!set liste_variable=!append item $jbox_$(l_[1]) to $liste_variable
!set script$i=!replace internal $jbox_$(l_[1]) by $(l_[2]) in $(script$i)
!set l_=!declosing $(l_[2])
!set l_=!itemcnt $l_
!set liste_dim=!append item $l_ to $liste_dim
!next
!if $responsive=yes
!set size=[$xsize x $ysize,$jbox_option_]
!else
!set size=$xsize x $ysize
!endif
!set oef_answer_option$i=$jbox $your_brd,$size,$(oef_answer_option$i)\
$liste_variable
!set style_point=!getopt style in $(replyoption$i)
!set style_point=!declosing $style_point
!default style_point=size: 1, showInfobox: false, name:''
!if freepoint isin $(replyoption$i)
!set script$i=$(script$i)\
var jsxbox_free=[];\
JXG.addEvent(document.getElementById('$jbox'), 'click', function (e) {\
var coords = new JXG.Coords(JXG.COORDS_BY_SCREEN, $(your_brd).getMousePosition(e),$(your_brd));\
var p=$(your_brd).create('point', coords.usrCoords.slice(1),{$style_point});\
var c = [p.X(), p.Y()];\
jsxbox_free.push(c);\
}, this);
!endif
!readproc slib/geo2D/jsxgraph $jbox $your_brd,$size,$(script$i)
$slib_out
<script>
/*<![CDATA[*/
var capture$i = function() {
document.getElementById('jsreply$i').value=
!for j=1 to $cnt_var
!set rep=!replace internal var by rep in $(liste_variable[$j])
!if $(liste_dim[$j])=1
$(rep).X() + ';' +
!else
$(rep).X() + ',' + $(rep).Y() + ';' +
!endif
!next
!if freepoint isin $(replyoption$i)
'free=' + jsxbox_free + ';' +
!endif
'';}
/*]]>*/
</script>
<input type="hidden" name="reply$i" id="jsreply$i" value="">
!set oef_js_submit=$oef_js_submit capture$i();
!reset your_brd jbox
|