Rev 15275 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8783 | bpr | 1 | !reset inputsize |
2 | !if $wims_read_parm=$empty |
||
13736 | bpr | 3 | !exit |
8783 | bpr | 4 | !endif |
5 | !if $wims_read_parm=help |
||
13736 | bpr | 6 | !read help/$lang/special/drawinput.phtml |
7 | !exit |
||
8783 | bpr | 8 | !endif |
9 | |||
10 | !set parm=!replace internal $ $ by $\ |
||
11 | $ in $wims_read_parm |
||
12 | |||
13 | !set code=!item 1 of $parm |
||
14 | !set code=!declosing $code |
||
15 | !set code=!rows2lines $code |
||
16 | !set code=!trim $code |
||
17 | |||
18 | !set inputsize=!item 2 to -1 of $parm |
||
19 | !set parm=!line 2 to -1 of $inputsize |
||
20 | !set inputsize=!line 1 of $inputsize |
||
21 | |||
22 | !distribute items $inputsize into bigsize,inputsize,option |
||
23 | |||
24 | !set bigsize=!translate x, to $ $ in $bigsize |
||
25 | !distribute words $bigsize into bigsizex,bigsizey |
||
26 | |||
27 | !set inputsize=!item 1 of $inputsize |
||
28 | !default inputsize=1x5 |
||
29 | !set inputsize=!translate x to , in $inputsize |
||
30 | !!set inputsize=!items2words $inputsize |
||
31 | |||
13884 | bpr | 32 | !if $cmd=hint |
13736 | bpr | 33 | !read oef/canvasdraw.phtml $bigsizex,$bigsizey\ |
13884 | bpr | 34 | $code |
13736 | bpr | 35 | !exit |
8783 | bpr | 36 | !endif |
37 | |||
38 | !! one parse the data for canvadraw to find the number of the line |
||
39 | !! where input are written. |
||
40 | !set parmcnt=!linecnt $parm |
||
41 | |||
42 | !reset hlist positionlist |
||
43 | !set m__=0 |
||
44 | !reset codeinput |
||
45 | |||
46 | !for tt = 1 to $parmcnt |
||
13736 | bpr | 47 | !set ld=!line $tt of $parm |
48 | !reset inputsize_tmp |
||
49 | !distribute item $ld into m_,xy_,inputsize_tmp,css |
||
50 | !if $css!=$empty and $tt=1 |
||
51 | !set codeinputcss=inputstyle $css |
||
52 | !endif |
||
53 | !set xy_=!replace internal x by , in $xy_ |
||
54 | !distribute items $xy_ into x_,y_ |
||
55 | !default inputsize_tmp=$inputsize |
||
56 | !set reply_tmp=!nospace $m_ |
||
57 | !set rep_tmp=!replace internal reply by r in $reply_tmp |
||
58 | !set n_=!text select 0123456789 in $reply_tmp |
||
59 | !set n_=$[$n_] |
||
60 | !if debug iswordof $m_oefenv and ?analyze notin $(replygood$n_) |
||
61 | !read oef/special/debug.input $n_ |
||
62 | !endif |
||
63 | !set inputsize_tmp=!translate x to , in $inputsize_tmp |
||
64 | !if $(inputsize_tmp[2])=$empty and $(inputsize_tmp[1])!=$empty |
||
65 | !set inputsize_tmp=1,$inputsize_tmp |
||
66 | !endif |
||
67 | !set inputsize_tmp=!nospace $inputsize_tmp |
||
68 | !default inputsize_tmp=$inputsize |
||
8783 | bpr | 69 | |
13736 | bpr | 70 | !if $n_!=$empty and $(replytype$n_) iswordof numeric nocase case atext \ |
8867 | bpr | 71 | range litexp algexp formal equation function default raw symtext set aset fset |
8783 | bpr | 72 | !set embedded=!append item r$n_ to $embedded |
73 | !increase m__ |
||
13884 | bpr | 74 | !if $printing=yes |
75 | !set codeinput=!append line text black,$[$x_],$[$y_],,$prompt_empty to $codeinput |
||
76 | !else |
||
77 | !set codeinput=!append line input $[$x_],$[$y_],$(inputsize_tmp[2]),1,$(reply$n_)$ $ to $codeinput |
||
78 | !endif |
||
17176 | bpr | 79 | !set hlist=$hlist<input type="hidden" id="oefvar$[$m__]" name="reply$n_" value=""> |
8783 | bpr | 80 | !set oef_js_submit=!append word my_canvasdraw$m__(); to $oef_js_submit |
81 | !set list_$n_=$m__ |
||
82 | !endif |
||
83 | !next |
||
9003 | bpr | 84 | !default codeinputcss=inputstyle background-color:white;font-size:1.1em; |
85 | |||
8783 | bpr | 86 | !set oef_js_submit=!append word my_canvasdraw(); to $oef_js_submit |
15275 | bpr | 87 | |
8783 | bpr | 88 | !set code_=!nonempty lines $bigsizex,$bigsizey\ |
89 | $code\ |
||
9002 | bpr | 90 | $codeinputcss\ |
8783 | bpr | 91 | $codeinput |
13884 | bpr | 92 | !if $printing=yes |
93 | !read oef/canvasdraw.phtml $code_ $ $ |
||
94 | !exit |
||
95 | !endif |
||
8783 | bpr | 96 | !if $q_form=yes |
13736 | bpr | 97 | $hlist |
98 | !read oef/canvasdraw.phtml $code_ $ $ |
||
15275 | bpr | 99 | !set canvasid=!text select 0123456789 in $canvasdraw_idclass |
100 | <script> |
||
101 | /*<![CDATA[*/ |
||
102 | !for m = 1 to $m__ |
||
103 | function my_canvasdraw$m() { |
||
104 | fun=eval('read_canvas$canvasid'); |
||
105 | var p= new Array(); p = fun(); |
||
106 | document.getElementById('oefvar' + $m).value=p[$m-1]; |
||
107 | } |
||
108 | !next |
||
109 | /*]]>*/ |
||
110 | </script> |
||
8783 | bpr | 111 | !else |
13736 | bpr | 112 | !reset code_r |
113 | !read themes/$wims_theme/oefcolors |
||
114 | !if $oef_indbad=$empty |
||
115 | !read themes/oefcolors |
||
116 | !endif |
||
117 | !distribute item $oef_indbad,$oef_indgood,$oef_indforget, $oef_indpartial, $oef_indprec\ |
||
118 | into colorr_bad, colorr_good, colorr_forget, colorr_partial, colorr_prec |
||
119 | !for c in $embedded |
||
120 | !set ii=!replace internal r by in $c |
||
121 | !set rep$ii=!replace internal $\ |
||
8783 | bpr | 122 | $ by , in $(reply$ii) |
13736 | bpr | 123 | !default reply_$ii=$(reply$ii) |
124 | !set tt=!word 1 of $(replygood$ii) |
||
125 | !if $tt!=?analyze |
||
126 | !set cl=$(colorr_$(diareply$ii)) |
||
127 | !if $(precreply$ii)=yes |
||
128 | !set cl=$(colorr_prec) |
||
129 | !endif |
||
130 | !if $(partialgood$ii)=yes |
||
131 | !set cl=$(colorr_partial) |
||
132 | !endif |
||
133 | !else |
||
134 | !set cl=$colorr_ana |
||
8867 | bpr | 135 | !endif |
13736 | bpr | 136 | !! if nextline is decommented, no analyze at the end. |
137 | !!set embedded_analyze=!append item $i to $embedded_analyze |
||
138 | !set embedded_bracket=$embedded_bracket [$ii] |
||
139 | !set replyname$ii=[$ii] |
||
140 | !set code_r_=!line $(list_$ii) of $codeinput |
||
141 | !set code_r_=!item 1 to 3 of $code_r_ |
||
8783 | bpr | 142 | |
13736 | bpr | 143 | !set code_r=$code_r\ |
8783 | bpr | 144 | inputstyle color:$cl;\ |
145 | $code_r_,0,$(reply_$ii) $(replyname$ii) |
||
13736 | bpr | 146 | !set replyname$m_=[$m_] |
147 | !next |
||
8783 | bpr | 148 | |
13736 | bpr | 149 | !set code_r_=!nonempty lines $bigsizex,$bigsizey\ |
8783 | bpr | 150 | $code\ |
151 | $code_r |
||
152 | |||
13736 | bpr | 153 | !read oef/canvasdraw.phtml $bigsizex,$bigsizey\ |
8783 | bpr | 154 | $code_r_ |
155 | |||
156 | !endif |