Subversion Repositories wimsdev

Rev

Rev 17205 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
17192 bpr 1
!reset inputsize
2
!if $wims_read_parm=$empty
3
  !exit
4
!endif
5
!if $wims_read_parm=help
6
  !read help/$lang/special/jsxgraphinput.phtml
7
  !exit
8
!endif
9
!set parm=!replace internal ,   r by $  r in $wims_read_parm
10
!set parm=!replace internal $   $ by $\
11
$ in $parm
12
 
13
!set script_jsxgraph=!item 1 of $parm
14
!set script_jsxgraph=!declosing $script_jsxgraph
15
 
16
!set global_css=!item 2 of $parm
17
!set global_css=!word 1 of $global_css
18
!set global_css=!declosing $global_css
19
 
20
!set tempbrd=$script_jsxgraph
21
!set tempbrd=!replace internal initBoard by $ $@@@@$ $ in $tempbrd
22
!set tempbrd=!replace internal . by $ $ in $tempbrd
23
!set pos=!positionof word @@@@ in $tempbrd
24
!set tempbrd=!replace internal = by $ $ in $tempbrd
25
!set tempbrd=!words2items $tempbrd
26
!set tempbrd=!nonempty item $tempbrd
27
!set itempos=!positionof item @@@@ in $tempbrd
28
!set board=!item $[$itempos-3] of $tempbrd
29
 
30
!set inputsize=!item 2 to -1 of $parm
31
!set parm=!line 2 to -1 of $inputsize
32
!set inputsize=!line 1 of $inputsize
33
 
34
!if noanswer isin $inputsize
35
  !set noanswer=1
36
!endif
37
 
38
!set inputsize=!item 1 of $inputsize
39
!default inputsize=4em
40
!set inputsize=!items2words $inputsize
41
 
42
!set parmcnt=!linecnt $parm
43
!set parm=!sort reverse line $parm
44
 
45
!set sp_jsx_css=<style>\
46
.oef_indbad .jxgbox {border-color: var(--oef_indbad);}\
47
.oef_indgood .jxgbox {border-color: var(--oef_indgood);}\
48
</style>
49
 
50
!reset hlist positionlist
51
!for tt = 1 to $parmcnt
52
  !set ld=!line $tt of $parm
53
  !reset inputsize_tmp
54
  !distribute item $ld into m_,xy_,before,css
55
  !set css=!declosing $css
56
  !set xy_=!replace internal x by , in $xy_
57
  !distribute items $xy_ into x_,y_
58
  !set reply_tmp=!nospace $m_
59
  !set rep_tmp=!replace internal reply by r in $reply_tmp
60
  !set n_=!text select 0123456789 in $reply_tmp
61
  !set n_=$[$n_]
62
  !if debug iswordof $m_oefenv and ?analyze notin $(replygood$n_)
63
    !read oef/special/debug.input $n_
64
  !endif
65
  !if $n_!=$empty and $(replytype$n_) iswordof numeric nocase case atext \
66
range litexp algexp formal equation function matrix raw default set aset fset
67
    !set embedded=!append item r$n_ to $embedded
68
    !if $css=$empty
69
      !set hlist=$hlist\
70
var in$n_=$board.create('input',[$x_,$y_,'$(reply$n_)','$before'],{cssStyle: $global_css});
17233 bpr 71
      !set inn=$inn <input type="hidden" name="reply$n_" value="">
17192 bpr 72
      !set formm=$formm document.forms['replyform'].reply$n_.value=""+in$n_.Value();
73
    !else
74
      !set hlist=$hlist\
75
var in$n_=$board.create('input',[$x_,$y_,'$(reply$n_)','$before'],{cssStyle: $css });
17233 bpr 76
      !set inn=$inn <input type="hidden" name="reply$n_" value="">
17192 bpr 77
      !set formm=$formm document.forms['replyform'].reply$n_.value=""+in$n_.Value();
78
    !endif
79
    !set nrep=!append item $n_ to $nrep
80
  !endif
81
!next tt
82
 
83
!set script_jsxgraph=$script_jsxgraph\
84
$hlist
85
 
86
!readproc slib/geo2D/jsxgraph $script_jsxgraph
87
!set graph=$slib_out
88
 
89
!if $q_form=yes
90
  $graph
91
  $inn
92
  <script>function read_graph(){ $formm }</script>
93
  !set oef_js_submit=$oef_js_submit read_graph()
94
!else
95
  $(sp_jsx_css)
96
  !read themes/$wims_theme/oefcolors
97
  !if $oef_indbad=$empty
98
    !read themes/oefcolors
99
  !endif
100
  !set cl=good
101
  !for tt = 1 to $parmcnt
102
    !set reply_tmp=!nospace $m_
103
    !set rep_tmp=!replace internal reply by r in $reply_tmp
104
    !set n_=!text select 0123456789 in $reply_tmp
105
    !set n_=$[$n_]
106
    !if $n_!=$empty and $(replytype$n_) iswordof numeric nocase case atext \
107
range litexp algexp formal equation function matrix raw default set aset fset
108
      !set hllist=$hllist\
109
in$tt.setAttribute({disabled:true});
110
      !if $(diareply$tt)!=good
111
        !set cl=bad
112
      !endif
113
    !endif
114
  !next tt
115
 
116
  !set script_jsxgraph=$script_jsxgraph\
117
$hlist $hllist
118
  !readproc slib/geo2D/jsxgraph $script_jsxgraph
119
  !set graph=$slib_out
120
 
121
  !if  $noanswer!=1
122
    $sp_jsx_css
17205 bpr 123
    <div class="oef_ind$cl">
17192 bpr 124
    $graph
125
    </div>
126
  !endif
127
!endif