Subversion Repositories wimsdev

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if $wims_read_parm!=slib_header
2
 !goto proc
3
!endif
688 bpr 4
!!slib_title=Geogebra Applet
20 reyssat 5
slib_parms=2\
103 bpr 6
,applet command for javascript, one by line or joined bu a semicolon\
7
,option (for example : <tt>width=300 height=300</tt>)\
20 reyssat 8
slib_author=Paul BYACHE et Bernadette PERRIN-RIOU
9
slib_out=
10
 
103 bpr 11
slib_comment=The first parameter is the appletcommand&#46; <br>Be careful &#58; \
12
at least a comma " &#44;" for not to have a confusion between applet commands and applet options.\
13
<br>Allowed options are the followings:\
20 reyssat 14
<br><tt>height</tt> default 300\
15
<br><tt>width</tt> default 300\
103 bpr 16
<br><tt>file</tt> default none&#46; Be careful &#58; the &#46;ggb file must be in the "image" \
17
directory if you use the slib in an OEF exercise, \
18
<br>in the "files" directory if you use the slib in a document ;\
19
<br>otherwise you have to use relative adress from module directory.\
20 reyssat 20
<br><tt>showToolBar</tt> default false\
103 bpr 21
<br><tt>customToolBar</tt> default none. Be careful : no comma is allowed and if you want \
22
<br>to separate two integers by a space-character, type a "@" instead of this space-character !\
20 reyssat 23
<br><tt>showMenuBar</tt> default false\
24
<br><tt>showAlgebraInput</tt> default false\
25
<br><tt>language</tt> default fr\
26
<br><tt>debug</tt> default false\
103 bpr 27
<br><tt>js</tt> for extra javascript commands for geogebra in brackets
28
<br><tt>number</tt> number of the applet in the html page (default 1)
20 reyssat 29
<br><tt>EXAMPLE\
30
<br><tt>&#92;integer{x=random(3)}\
31
<br><tt>&#92;text{appletcommand= Z=(&#92;x,3.78)&#92;\
32
<br><tt>W=(6.2,2.8)&#92;\
33
<br><tt>Ellipse[Z,W,5]&#92;\
34
<br><tt>u=Line[W,Z]}\
35
<br><tt>#the language can be setted in the options\
36
<br><tt>&#92;text{option= showToolBar=true\
37
<br><tt>language=en\
103 bpr 38
<br><tt>customToolBar="0|5@40 10||1|2"\
20 reyssat 39
<br><tt>width=600\
103 bpr 40
<br><tt>height=500\
167 bpr 41
<br><tt>js=[setVisible('W',false)]\
103 bpr 42
<br><tt>number=1</tt>
20 reyssat 43
<br><tt>#to hide the axes or the algebra window (on the left), use a ".ggb" file in the options\
44
<br><tt>&#92;text{applet=slib(geo2D/geogebra  &#92;appletcommand , &#92;option)}\
45
<br><tt>&#92;statement{&#92;applet}
46
 
103 bpr 47
slib_example=Z=(-3,6.78);W=(0.2,5.8);a=Circle[Z,W];Ellipse[Z,W,5];u=Line[W,Z],showMenuBar=true;showToolBar=true;language=en;customToolBar="0|40@10||1|2";width=600;height=300\
48
A=(0,6);B=(0,8);a=Cercle[A,B];d:y=2x+1,number=2;width=600;language=fr;showToolBar=true;customToolBar="0|40"\
49
A=(0,6);B=(0,8);C=(2,6);Angle[C,A,B];a=Droite[A,B];D=Point[a];b=6;f(x)=b+sin(x),number=3;width=600;language=fr
20 reyssat 50
!exit
51
 
52
:proc
53
 
54
 
55
!!!!!pour ne pas afficher l'applet lors de l'analyse de la réponse
103 bpr 56
!if $(reply$1) != $empty
57
!exit
58
!endif
20 reyssat 59
 
103 bpr 60
!!!!!pour l'instant, la syntaxe pour slib_data est la syntaxe "GeoGebra". 
61
!!! Par la suite, il faudrait que la syntaxe "wims" (celle du anstype) soit aussi reconnue.
20 reyssat 62
 
63
!default slib_cnt=0
64
slib_cnt= $[$slib_cnt +1]
65
slib_data= !item 1 of $wims_read_parm
103 bpr 66
slib_data=!translate $	$ to $\
67
$ in $slib_data
20 reyssat 68
slib_z2= $slib_data
103 bpr 69
 
70
slib_option= !item 2 to -1 of $wims_read_parm
20 reyssat 71
slib_option= !replace internal , by @ in $slib_option
103 bpr 72
slib_option= !replace internal ; by $\
73
$ in $slib_option
74
slib_extra= !getopt js in $slib_option
20 reyssat 75
 
103 bpr 76
slib_extra=!declosing $slib_extra
77
slib_extra= !replace internal @ by , in $slib_extra
78
slib_extra=!words2lines $slib_extra
79
 
80
 
81
!for slib_a in file,width,height,showToolBar,showMenuBar,showAlgebraInput,customToolBar,language,debug,number
20 reyssat 82
  slib_$slib_a=!getopt $slib_a in $slib_option
83
!next slib_a
103 bpr 84
 
20 reyssat 85
slib_customToolBar= !nospace $slib_customToolBar
86
slib_customToolBar= !replace internal @ by , in $slib_customToolBar
87
slib_customToolBar= !replace internal || by % in $slib_customToolBar
88
slib_customToolBar= !replace internal | by ,|, in $slib_customToolBar
89
slib_customToolBar= !replace internal % by ,||, in $slib_customToolBar
90
slib_customToolBar= !items2words  $slib_customToolBar
91
 
92
!default slib_width=300
93
!default slib_height=300
94
!default slib_showToolBar=false
95
!default slib_showMenuBar=false
96
!default slib_showAlgebraInput=false
97
!default slib_language=fr
98
!default slib_debug=false
103 bpr 99
!default slib_customToolBar=none
100
!default slib_number=1
101
slib_number=$[$slib_number -1]
102
slib_data = !replace internal ; by $\
103
$ in $slib_data
104
slib_data=!replace internal $\$ by $\
105
$ in $slib_data
106
slib_data=!nonempty lines $slib_data
20 reyssat 107
 
103 bpr 108
slib_extra = !rows2lines $slib_extra
109
slib_extra=!replace internal $\$ by $\
110
$ in $slib_extra
111
$slib_extra
20 reyssat 112
 
113
slib_cnt=!linecnt $slib_data
114
slib_appletcommand=
115
!for slib_u=1 to $slib_cnt
116
  slib_line=!line $slib_u of $slib_data
103 bpr 117
  slib_line=!nospace $slib_line
118
  slib_appletcommand=!append line document.applets[$slib_number].evalCommand("$slib_line") to $slib_appletcommand
20 reyssat 119
!next
103 bpr 120
slib_cnt_extra=!linecnt $slib_extra
20 reyssat 121
 
103 bpr 122
!for slib_v=1 to $slib_cnt_extra
123
  slib_line=!line $slib_v of $slib_extra
124
  slib_appletcommand=!append line document.applets[$slib_number].$slib_line to $slib_appletcommand
125
!next
20 reyssat 126
slib_out=<applet codebase=java/geogebra code=geogebra.GeoGebraApplet \
127
archive=geogebra.jar width=$slib_width height=$slib_height>\
128
<param name=language value=$slib_language>\
129
<param name="showToolBar" value="$slib_showToolBar">\
130
<param name="framePossible" value="false">\
103 bpr 131
<param name="showMenuBar" value="$slib_showMenuBar">\
132
<param name="showAlgebraInput" value="$slib_showAlgebraInput">
20 reyssat 133
 
134
!if $slib_file!=$empty
135
  slib_mod = $module_category
103 bpr 136
  slib_mod = !items2words $slib_mod
20 reyssat 137
  !if document iswordof $slib_mod
138
    slib_image_dir=$Docdir/$doc/files
139
  !endif
140
  !if oef iswordof $slib_mod
141
    slib_image_dir=$imagedir
142
  !endif
143
  !default slib_image_dir=$module_dir
144
 
145
 slib_out=$slib_out \
146
 <param name="filename" value="../../$slib_image_dir/$slib_file">
147
!endif
148
!if $slib_customToolBar!=$empty
149
  slib_out=$slib_out \
150
  <param name="customToolBar" value="$slib_customToolBar">
151
!endif
152
 
153
slib_out=$slib_out \
154
</applet>\
155
<script language="JavaScript">\
156
   $slib_appletcommand\
157
</script>
158
slib_z1=$wims_read_parm
159
!if $slib_debug=true
160
  slib_out=$slib_out \
161
<br><br>Parameters read by the applet : $slib_z1<br><br>The slib_data : $slib_z2 --> $slib_data
162
!endif