Rev 15014 | Rev 16306 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
!! process to manage geogebra zone
!! firstline word1 : type of process to read / word 2 teacher or student / word 3 identification num of zone
!! script_data=entry parameters
!! script_output= reply parameter
!distribute word $wims_read_parm into proc_,stype_,zone_,activated_,user_
!bound activated_ within 1,0 default 0
!goto $proc_
!exit
:parahtml
!! form html interface for parameters
!! ----- first parameter (title)
!let num_=$[($zone_-1)*5+1]
<div class="field box">
!if $activated_=1
<label for="param$(stype_)$num_"> $(name_titlezone)</label>
<input type="text" id="param$(stype_)$num_" name="param$(stype_)$(num_)" value="$(param$(stype_)$(num_))" />
<div class="formHelp">$name_desc_title</div>
!else
<strong>$(name_titlezone)</strong>
<p>$(param$(stype_)$(num_))</p>
!endif
</div>
!! ----- second parameter - description
!let num_=$[($zone_-1)*5+2]
<div class="field box">
!if $activated_=1
<label for="param$(stype_)$num_"> $(name_desczone)</label>
<textarea name="param$(stype_)$(num_)" id="param$(stype_)$(num_)" rows="10" cols="100" class="iEdit" maxlength="$desc_limit">$(param$(stype_)$(num_))</textarea>
!! <input type="text" id="param$(stype_)$num_" name="param$(stype_)$(num_)" value="$(param$(stype_)$(num_))" />
<div class="formHelp">$name_desc_desc</div>
!else
<strong>$(name_desczone)</strong>
<div>
!let insmath_rawmath=yes
!let wims_backslash_insmath=yes
$(param$(stype_)$(num_))
!let insmath_rawmath=no
!let wims_backslash_insmath=no
</div>
!endif
</div>
!! --- parameter 3 (geogebra applet option)
!let num_=$[($zone_-1)*5+3]
<div class="field box">
!if $activated_=1
<label for="param$(stype_)$num_">$(name_applet_geogebra[1])</label><br/>
<textarea id="param$(stype_)$num_" rows="6" cols="65" name="param$(stype_)$(num_)">$(param$(stype_)$(num_))</textarea>
!else
<strong>$(name_applet_geogebra[1])</strong>
<pre>$(param$(stype_)$(num_))</pre>
!endif
</div>
!! --- parameter 4 for student (copy teacher zone)
!if $stype_=student
!let num_=$[($zone_-1)*5+4]
<div class="field box">
!set l_=!values v for v=1 to $nbrezoneteacher
!if $activated_=1
<label for="param$(stype_)$num_">$(name_applet_geogebra[2])</label><br/>
!formselect param$(stype_)$(num_) list 0,$ltgeogebrateacherzone prompt $name_noone,$ltgeogebrateacherzone
!else
<strong>$(name_applet_geogebra[2])</strong>
!if $(param$(stype_)$(num_))!=$empty
!item $[$(param$(stype_)$(num_))+1] of $name_noone,$l_
!endif
!endif
</div>
!endif
!! --- parameter 4 for teacher (hide zone when display for student)
!if $stype_=teacher
!let num_=$[($zone_-1)*5+4]
<div class="field box">
!if $activated_=1
<label for="param$(stype_)$(num_)">$(name_applet_geogebra[3])</label><br/>
!formselect param$(stype_)$(num_) list yes,no prompt $wims_name_yes,$wims_name_no
!else
<strong>$(name_applet_geogebra[3])</strong>
!if $(param$(stype_)$(num_))!=$empty
!if $(param$(stype_)$(num_))=yes
$wims_name_yes
!else
$wims_name_no
!endif
!endif
!endif
</div>
!exit
:pararead
!! parameter reading
!distribute line $script_data into param$(stype_)$[($zone_-1)*5+1],param$(stype_)$[($zone_-1)*5+2],tmp_,param$(stype_)$[($zone_-1)*5+4]
!! --- parameter save 1 (title)
param$(stype_)$[($zone_-1)*5+1]=!line 1 of $script_data
param$(stype_)$[($zone_-1)*5+1]=!detag $(param$(stype_)$[($zone_-1)*5+1])
param$(stype_)$[($zone_-1)*5+1]=!char 1 to $title_limit of $(param$(stype_)$[($zone_-1)*5+1])
!! --- parameter save 2 (description)
param$(stype_)$[($zone_-1)*5+2]=!line 2 of $script_data
param$(stype_)$[($zone_-1)*5+2]=!char 1 to $desc_limit of $(param$(stype_)$[($zone_-1)*5+2])
!! --- parameter save 3 (geogebra applet option)
tmp_=!nospace $tmp_
tmp_=!detag $tmp_
tmp_=!replace internal ; by $\
$ in $tmp_
!! -- delete somes parameters
!for name_ in number,ggbBase64,showToolBar
t_=!getopt $name_ in $tmp_
!if $t_!=$empty
tmp_=!replace internal $name_=$t_ by $empty in $tmp_
!endif
!next name_
param$(stype_)$[($zone_-1)*5+3]=!nonempty line $tmp_
!default param$(stype_)$[($zone_-1)*5+3]=height=600;width=800
!! --- parameter save 4 (different for student or teacher)
!if $stype_=teacher
!bound param$(stype_)$[($zone_-1)*5+4] within yes,no default no
ltgeogebrateacherzone=!append item $zone_ to $ltgeogebrateacherzone
!else
!bound param$(stype_)$[($zone_-1)*5+4] between 0 and $nbrezoneteacher default 0
!endif
!exit
:parasave
!! --- parameter save 1 (title)
output_data=!replace internal $\
$ by ; in $(param$(stype_)$[($zone_-1)*5+1])
output_data=!detag $output_data
output_data=!char 1 to $title_limit of $output_data
!! --- parameter save 2 (description)
tmpdata_=!replace internal $\
$ by ; in $(param$(stype_)$[($zone_-1)*5+2])
tmpdata_=!char 1 to $desc_limit of $tmpdata_
output_data=$output_data\
$tmpdata_
!! --- parameter save 3
tmpdata_=!replace internal $\
$ by ; in $(param$(stype_)$[($zone_-1)*5+3])
tmpdata_=!nospace $tmpdata_
tmpdata_=!detag $tmpdata_
tmpdata_=!replace internal ; by $\
$ in $tmpdata_
!for name_ in number,ggbBase64,showToolBar
t_=!getopt $name_ in $tmpdata_
!if $t_!=$empty
tmp_=!replace internal $name_=$t_ by $empty in $tmpdata_
!endif
!next name_
tmpdata_=!nonempty line $tmpdata_
tmpdata_=!replace internal $\
$ by ; in $tmpdata_
!default tmpdata_=height=600;width=800
output_data=$output_data\
$tmpdata_
!! --- parameter save 4 (different for student or teacher)
!if $stype_=teacher
!bound param$(stype_)$[($zone_-1)*5+4] within yes,no default no
!else
!bound param$(stype_)$[($zone_-1)*5+4] between 0 and $nbrezoneteacher default 0
!endif
output_data=$output_data\
$(param$(stype_)$[($zone_-1)*5+4])
!exit
:displayhtml
!if $stype_=teacher
!if ($wims_user!=supervisor or ($wims_user=supervisor and $user_!=$empty)) and $(param$(stype_)$[($zone_-1)*5+4])=no
!exit
!endif
!set ggbbase64=!record 0 of wimshome/log/classes/$wims_class/freeworks/$freework/.$stype_-geogebra$zone_
!else
!set t_=!fileexists wimshome/log/classes/$wims_class/freeworksdata/$freework/work/$user_-geogebra.$zone_
!if $t_=no
!if $(paramstudent$[($zone_-1)*5+4])!=$empty and $(paramstudent$[($zone_-1)*5+4]) isitemof $ltgeogebrateacherzone
!set ggbbase64=!record 0 of wimshome/log/classes/$wims_class/freeworks/$freework/.teacher-geogebra$(paramstudent$[($zone_-1)*5+4])
!endif
!else
!set ggbbase64=!record 0 of wimshome/log/classes/$wims_class/freeworksdata/$freework/work/$user_-geogebra.$zone_
!endif
!endif
<div class="field box">
!if $job!=configfw
<h2 class="box_title">
!if $(param$(stype_)$[($zone_-1)*5+1])!=$empty
$(param$(stype_)$[($zone_-1)*5+1])
!else
$name_zone $zone_
!endif
</h2>
!let insmath_rawmath=yes
!let wims_backslash_insmath=yes
<div class="freeworkdesczone">$(param$(stype_)$[($zone_-1)*5+2])</div>
!let insmath_rawmath=no
!let wims_backslash_insmath=no
!else
!if $activated_=1
<label for="applet$zone_">$(name_zonecontent)</label>
!else
<strong>$(name_zonecontent)</strong>
!endif
!endif
!increase appletnum
!if $activated_=1 or $wims_user=supervisor
<input type="hidden" name="freepar_applet$zone_" id="applet$zone_" />
!let tmp_=showToolBar=true
!else
!! desactivated Toolbar if $activated_!=1
!let tmp_=showToolBar=false
!endif
!if $ggbbase64!=$empty
!readproc slib/geo2D/geogebra ggbBase64=$ggbbase64;$(param$(stype_)$[($zone_-1)*5+3]);$tmp_;number=$appletnum
!else
!readproc slib/geo2D/geogebra $(param$(stype_)$[($zone_-1)*5+3]);$tmp_;number=$appletnum
!endif
$slib_out
!if $activated_=1
!let onclickactionlist=!append word freepar_applet$(zone_).value=document.ggbApplet$[$appletnum-1].getBase64(); to $onclickactionlist
!endif
!reset ggbbase64
</div>
!exit
:displayread
!exit
:displaysave
!if $(freepar_applet$zone_)!=$empty
!if $stype_=teacher
file_=wimshome/log/classes/$wims_class/freeworks/$freework/.$stype_-geogebra$zone_
!else
file_=wimshome/log/classes/$wims_class/freeworksdata/$freework/work/$user_-geogebra.$zone_
!endif
!writefile $file_ $(freepar_applet$zone_)
!endif
!exit