<!-- BEGIN of html/headmenu_user -->
!read name.phtml.$lang
!read themes/_lang/name.phtml.$lang
!read themes/$wims_theme/lang/name.phtml.$lang
!default wims_name_bgcolor=$wims_ref_bgcolor
!if $wims_hm$wims_home_items$wims_link_close!=$empty
  !goto defend
!endif

!if $module=adm/class/tchat and $job=viewpage
  !reset wims_hm,wims_home_items,wims_link_close
  !let wims_hm=back,3,window.close();$wims_href_opener
  !goto defend
!endif

!reset 1_ home_
!if _ isin $wims_session
  !if _exam isin $wims_session
    !set wims_pses=!translate _ to , in $wims_session
    !set wims_pses=!item 1 of $wims_pses
    !set wims_pser=!randint 1,99999
    !set wims_href_opener=window.opener.location='$wims_ref_name?session=$wims_pses.1&+cmd=reply&+job=student&+randomizer=$wims_pser';
    !! ---------- progressbar in case of course mode
    !if $(wims_exrandomlist[3;])=1
      !readproc examprogressbar.proc
      !set 1_=!append line progress,0,&nbsp;$wims_progressbar&nbsp; to $1_
    !endif
    !! ---------- add timer on page
    <script>
      !read js/chronoid.js
    </script>
    !set rd=!randint 111111,999999
    !set 1_=!append line chrono,0,&nbsp;<span id="chrono_exam"></span>&nbsp;<script>clockid($wims_exam_remain,"chrono_exam");window.opener.location='$wims_ref_name?session=$wims_pses.1&+cmd=reply&+job=student&+randomizer=$rd';</script> to $1_
  !endif
  !if $module=adm/class/tchat
    !if $job!=close
      !set 1_=!append line tchatclose,1,cmd=reply&module=adm/class/tchat&job=close to $1_
    !endif
  !else
    !set 1_=!append line back,3,window.close();$wims_href_opener to $1_
  !endif
!else
  !if $module!=home or ($module=home and $seq!=$empty)
    !set home_=!append line class_home,1,session=$wims_session.1 to $home_
  !else
    !set home_=!append line class_home,8, to $home_
  !endif
!endif

!!! deconnexion link

!if _ notin $wims_session
  !if $class_cas_auth!=$empty
    !if $wims_user=supervisor
      !set wims_link_close=!append line visitor,1,cmd=close&module=adm/class/classes&type=supervisor&class_auth=$class_cas_auth to $wims_link_close
    !else
      !if $wims_class!=$empty
        !set wims_link_close=!append line visitor,1,cmd=close&module=adm/class/classes&type=participant&class_auth=$class_cas_auth to $wims_link_close
      !else
        !set wims_link_close=!append line visitor,1,cmd=close&class_auth=$wims_cas_auth to $wims_link_close
      !endif
    !endif
  !else
    !if $wims_user=supervisor
      !set wims_link_close=!append line visitor,1,cmd=close&module=adm/class/classes&type=supervisor to $wims_link_close
    !else
     !!!set registered=!record 0 of wimshome/$wims_sesdir/examreg.1
     !if $registered!=$empty
!! during an exam.
        !set wims_link_close=!append line endexam,1,module=adm/class/exam&cmd=reply&job=scorereg to $wims_link_close
      !else
        !if $wims_user=anonymous
          !set wims_link_close=!append line visitor,1,cmd=close&module=adm/class/classes&type=example to $wims_link_close
        !else
          !set wims_link_close=!append line visitor,1,cmd=close&module=adm/class/classes&type=participant to $wims_link_close
        !endif
      !endif
    !endif
  !endif
!endif

!if _check isin $wims_session
  !! it is the case for examlog or exolog or freeworklog
  !set ckstep=$special_parm
  !distribute item $wims_check into ckmodule,ckuser,cksession,ckexo,cksteps,score
  !set qstr=module=$ckmodule&+cmd=new&+job=examcheck&+checkuser=$ckuser&+checksession=$cksession&+checkexo=$ckexo
  !set 2_=$wims_page_name : &nbsp;
  !ifval $ckstep>1
    !set 2_=$2_<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=1">1</a>&nbsp;
    !if $ckstep=2
      !set 2_=$(2_)2&nbsp;
    !else
      !if $ckstep=3
        !set 2_=$(2_)<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=2">2</a>&nbsp;3&nbsp;
      !else
        !set 2_=$(2_)&nbsp;...&nbsp;<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=$[$ckstep-1]">$[$ckstep-1]</a>&nbsp;$ckstep&nbsp;
      !endif
    !endif
  !else
    !set 2_=$2_ 1 &nbsp;
  !endif
  !if $ckstep<$cksteps
    !ifval $ckstep<$cksteps-2
      !set 2_=$2_<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=$[$ckstep+1]">$[$ckstep+1]</a>&nbsp;...&nbsp;<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=$cksteps">$cksteps</a>
    !else
      !ifval $ckstep=$cksteps-2
        !set 2_=$2_<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=$[$ckstep+1]">$[$ckstep+1]</a>&nbsp;<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=$cksteps">$cksteps</a>
      !else
        !ifval $ckstep=$cksteps-1
          !set 2_=$2_<a href="$wims_ref_name?session=$session&+$qstr&+checkstep=$[$ckstep+1]">$[$ckstep+1]</a>
        !endif
      !endif
    !endif
  !endif
  !set 1_=!append line nav,0,$2_ to $1_
  !set 3_=!translate internal - to , in $ckexo
  !set 3_=!item -1 of $3_
  !if $wims_user=supervisor
    !if $ckexo=file and $wims_checktitle!=$empty
      !set tmp=$wims_checktitle
    !else
      !set tmp=$ckuser: $3_=$module,$cksteps steps, $score/10
    !endif
  !else
    !set tmp=
  !endif
  !set 2_=<small>$tmp.</small>
  !reset tmp
  !set wims_hm=!append line score,0,$2_ to $1_
  !goto defend
!endif
!!!if adm/forum notin $module and _ notin $wims_session \
!!  and $wims_sheet=$empty
 !!!set 1_=!append line forum,1,module=adm/forum/mboard to $1_
!!!endif
!!if $cmd=intro
!! !set 1_=!append line work,1,module=$module&cmd=new to $1_
!!endif
!if _exam isin $wims_session
  !set 1_=!append line tools,4,module=home,tool to $1_
!endif
!!!if _ notin $wims_session and adm/ notin $module and $cmd notwordof help ref
 !!!set 1_=!append line reference,4,module=$module&cmd=ref&special_parm=$cmd,ref to $1_
!!!endif
:ariane_sheet
!if ($wims_sequence>0 or $m_wims_sequence>0) \
  and (adm/sheet isin $module or $module_category!=adm or $module=adm/doc)
  !set tmp_=$m_wims_sequence
  !default tmp_=$wims_sequence
  !if $wims_user=supervisor
    !set wims_ariane=!append line sequence,1,module=adm/class/sequence&seq=$tmp_\
to $wims_ariane
  !else
    !set wims_ariane=!append line sequence,1,module=home&seq=$tmp_#sh$wims_sheet to $wims_ariane
  !endif
  !reset tmp_
  !set wims_ariane_self=no
!else
  !if adm/doc isin $module and $wims_user!=supervisor
    !set wims_ariane=!append line doc,8 to $wims_ariane
    !set wims_ariane_self=no
  !endif
  !if adm/class/freework isin $module
    !set wims_ariane=!append line Freework $freework,1,module=adm/class/freework&freework=$freework to $wims_ariane
    !set wims_ariane_self=no
  !endif
!endif
!if $wims_sheet>0 or P isin $wims_sheet
   !if swork=$(wims_listexo[1])
     !set wims_ariane=!append line swork,1,module=adm/class/swork& to $wims_ariane
   !else
     !set wims_ariane=!append line sheet,1,module=adm/sheet&sh=$wims_sheet#ex$wims_exo to $wims_ariane
   !endif
   !set wims_ariane_self=no
!else
   !if adm/sheet isin $module
     !set wims_ariane=!append line sheet,8 to $wims_ariane
     !set wims_ariane_self=no
   !endif
!endif

!if $job=print or $printing=yes
  !!goto defend
!endif
!if $cmd=help or $cmd=hint
  !set 1_=!append line resume,1,cmd=resume to $1_
!endif
!if $module_has_intro=yes and $cmd notwordof intro help and \
    $wims_sheet=$empty and $wims_fwnumber=$empty and exam notin $wims_session \
    and mfeed notin $wims_session and $wims_freework=$empty \
    and ($wims_user=$empty or $wims_user=supervisor)
  !if $wims_theme!=default
    !set wims_ariane=!append line intro,1,module=$module&cmd=intro&special_parm=$special_parm&special_parm2=$special_parm2&special_parm3=$special_parm3&special_parm4=$special_parm4 to $wims_ariane
    !set wims_ariane_self=no
  !else
    !set 1_=!append line intro,1,module=$module&cmd=intro&special_parm=$special_parm&special_parm2=$special_parm2&special_parm3=$special_parm3&special_parm4=$special_parm4 to $1_
  !endif
!endif
!if $wims_fwnumber!=$empty
    !set wims_ariane=!append line freework,1,module=adm/class/freework&cmd=new&freework=$(wims_fwnumber) to $wims_ariane
    !set wims_ariane_self=no
!endif
!! ------------ add link for sendbug (TEST TO BE IMPROVED ?)
!! TODO : change name of the window to open should be deleted when
!if $wims_class!=$empty and $wims_user=supervisor and adm/ notin $module and classes/ notin $module and devel/ notin $module and $module!=home and $cmd!=intro
  !let number_=!randint 1,1000
  !set 1_=!append line sendbug,4,module=adm/sendbug&cmd=new,sendbug$(number_) to $1_
!endif
!if $module_has_help=yes and $cmd notwordof intro help and _exam notin $wims_session
  !if $module_help=$empty or $module_help=popup
    !set 1_=!append line help,4,module=$module&cmd=help&special_parm=$wims_help_parm,mhelp to $1_
  !else
    !set 1_=!append line help,1,module=$module&cmd=help&special_parm=$wims_help_parm to $1_
  !endif
!endif

!if $wims_theme_version=0
  !if _ notin $wims_session
    !set 1_=!append line whelp,4,module=help/main&$wims_helper,help to $1_
  !endif
!endif

!!********* Link: "About"
!if $module_has_about=yes and $cmd notwordof help and $module!=home \
    and _exam notin $wims_session and _mfeed notin $wims_session \
    and ($wims_user iswordof supervisor developper or $wims_user=$empty)
  !set 1_=!append line about,4,module=$module&cmd=help&special_parm=about,mhelp,,$wims_name_module_infos ($module) to $1_
!endif

!set wims_hm=$1_
!set wims_home_items=$home_
:defend
!set wims_hm_cnt=!linecnt $wims_hm
!set wims_home_items_cnt=!linecnt $wims_home_items
!set wims_link_close_cnt=!linecnt $wims_link_close
!set wims_ariane_cnt=!linecnt $wims_ariane
!read themes.phtml header
<!--BEGINSUPVIEW-->
<div class="wimsbody">
!read themes/_widgets/adminalert.phtml
<!-- END of html/headmenu_user -->
!read themes/_widgets/freeworkmanage.phtml head
