!nocache
!! Pendant la creation via Createxo, c'est le module adm/createxo qui appelle ce fichier.

!if $oef_test=yes
  !set renewlink=cmd=next&retest=again
  !!$header_js
  !goto tester
!else
  !if $exocnt=1
    !set exoo=!item 1 of $exolist
    !if $module_init_parm=$empty
      !set module_init_parm=exo=$exoo
    !else
      !if &exo notin &$module_init_parm
        !set module_init_parm=exo=$exoo&$module_init_parm
      !endif
    !endif
  !endif
  !set init_parm=!translate + to $ $ in $module_init_parm
  !set init_parm=!replace internal $\
$ by ; in $init_parm
  !set renewlink=cmd=renew&worksheet=$worksheet&$init_parm
!endif

!if $(title_$lang)!=$empty
  !set title=$(title_$lang)
!endif
!if $(title_$lang_choice)!=$empty
  !set title=$(title_$lang_choice)
!endif
!!define the content of the balise title in the header.
!default module_title2=!detag $title

!if $printing=yes
  !changeto oef/print.phtml
!endif

!if $title!=$empty
  !set module_title=$title
  !set module_author=$author
  !set module_address=$email
!endif

!if 0$delay2>0 and $status!=$empty
  !set now_=$wims_nowseconds
  !set wims_html_header=!append line <script src="scripts/js/chronoid.js"></script> to $wims_html_header
  !set wims_html_onload= clockid($[max(0,$delay1-($now_-$starttime))],'clockoef');$wims_html_onload
!endif
!set wims_html_header=!append line $header_js to $wims_html_header
!set wims_html_header=!append line $oefcss to $wims_html_header

!if $wims_class!= and $class_css=yes
  !set parentsession=!translate _ to $ $ in $session
  !set parentsession=!word 1 of $parentsession
  !set wims_html_header=!append line <link href="$wims_ref_name?session=$parentsession&+cmd=getfile&+special_parm=css.css" rel="stylesheet">\
    to $wims_html_header
!endif

!if $status!=waiting
  !set wims_html_header=!append line <link rel="stylesheet" disabled="disabled" href="html/themes/_css/oef_print_solution.css" id="css_print" title="Solution only">\
    to $wims_html_header
!endif

!header1

!default wims_exotitleform=0

!if $wims_user=supervisor and $oefobservation!=$empty
  <div class="wims_msg info">
    <details>
     <summary>$name_authordesc</summary>
     $oefobservation
    <div class="formHelp">$name_authordesc_desc</div>
    </details>
  </div>
!endif

!if $intro_calc iswordof 1 2
  !reset tmp
  !if $intro_calc=1
    !set tmp=basic
  !endif
  <div class="float_right">
  !readproc slib/utilities/mathcalc $tmp
  $slib_out
  </div>
  !reset tmp
!endif
!if $(wims_exoicon[$wims_exo])!=$empty \
    and $(wims_exoicon[$wims_exo])!=none and _exam notin $wims_session
  <h1 class="oeftitle text_icon icon_$(wims_exoicon[$wims_exo]) fullwidth">
!else
  <h1 class="oeftitle">
!endif
!if _exam notin $wims_session
  !if $wims_exo!=$empty
    !if $wims_exotitleform>0
      !let p=!positionof item $wims_exo in $wims_listexo
      !if $wims_exotitleform=1
        $wims_name_sheet $wims_sheet - $wims_name_Serie $p
      !else
        $wims_sheettitle
        <br>
        !if $wims_exotitleform=2
          $wims_name_Serie $p
        !else
          $(wims_exotitle[$wims_exo])
        !endif
      !endif
    !else
      !if $wims_exotitleform=0
        $title
      !endif
    !endif
  !else
    $title
  !endif
!else _exam isin $wims_session
  !if $wims_exrandomlist!=$empty
    !let t=!replace internal . by , in $worksheet
    !let t2=!positionof item $(t[2]) in $(wims_exrandomlist[1;])
    $(t[1]).$t2
  !else
    $worksheet
  !endif
!endif
!if _exam notin $wims_session and $wims_exo!=$empty
  !set tmp=$(wims_exodesc[$wims_exo])
  !if $tmp notsametext $empty
    <div class="wims_tooltip" style="font-size:0.50em;">[...]
     <div class="wims_tooltiptext bottom_left" style="width:300px">$tmp</div>
    </div>
  !endif
!endif
</h1>

!if $module_checkdata!=yes
  !read oef/$modu_lang/nodata.phtml
  !goto end
!endif

!if $title=$empty
  $name_emptytitle
  <p class="wimscenter">
    !set wims_ref_class=wims_button
    !href module=$module $name_restart
    $wims_name_or
    !set wims_ref_class=wims_button
    !href $ $wims_name_giveup
  </p>
  <div class="wims_msg info small">$name_exo_giveup</div>
  !goto end
!endif

!if 0$delay1>0 and $status!=$empty
  <div class="wims_msg warning wims_clock" role="alert">
    <span class="wims_warning">$wims_name_warning!</span>
    !if $qnum>1
      $name_serie_limit
    !else
      $name_exo_limit
    !endif
    <span id="clockoef"></span>
  </div>
!endif

:tester
!! this div will close at :end
<div class="oefform">
  !read oef/present.phtml

!if $wims_theme_version= or $wims_theme_version<1
  <hr style="width:50%">
!endif

!if $cmd=hint
  !read oef/hint.phtml
  !goto end
!endif

!if $status=waiting
  !if $error!=$empty
    <div class="wims_msg alert">
    !read oef/msg.phtml
    </div>
  !endif
  !if ($hint!=$empty and $givehint>0) or $help!=$empty
    <div id="oef_helphint">
    !if $hint!=$empty and $givehint>0
      !if _exam isin $wims_session
        <span class="disabled_link">$name_Hint</span>
      !else
        !set wims_ref_class=wims_button_help
        !set wims_ref_id=oef_hint
        !href cmd=hint $name_Hint
      !endif
      $
    !endif
    !if $help!=$empty
      !!FIXME should be in src/exec.c
      !if _exam isin $wims_session
        <span class="disabled_link">$wims_name_help</span>
      !else
        !set wims_ref_class=wims_button_help
        !set wims_ref_id=oef_help
        !href cmd=help $wims_name_help
      !endif
      $
    !endif
    </div> <!-- id oef_helphint-->
  !endif
  !read oef/form.phtml
  <div id="oef_actions">
    !if $fieldtot = 0
      <div class="oef_exo_renew">
        !set wims_ref_class=wims_button
        !set wims_ref_id=oef_renew
        !href $renewlink $name_exo_renew
      </div>
    </div>
      !goto endmain
    !endif
    !!_check is there for examlog
    !if _exam notin $wims_session and _check notin $wims_session
      !if $jquery_defined=yes
        !! Displays a Modal dialog box explaining what the "giveup" button will do.
        <script>
        /*<![CDATA[*/
          jQuery(function(jq){
            jq("#exo_giveup").dialog({
              autoOpen: false,
              modal: true,
              buttons: {
                "$wims_name_yes": function() {window.location = '?session=$session&$renewlink';},
                "$wims_name_no": function() {jq(this).dialog("close");}
              }
            });
            jq("#exo_giveup_opener").on("click", function() {
              jq("#exo_giveup").dialog("open");
            });
          });
        /*]]>*/
        </script>
        <button class="wims_button wims_secondary_button" type="button" data-toggle="exo_giveup" id="exo_giveup_opener">$wims_name_giveup</button>
      !endif jquery
      <div class="dropdown-pane wims_msg info small" id="exo_giveup" title="$wims_name_giveup" data-dropdown>
        <div>
          !if $qnum>1
            $name_serie_giveup
          !else
            $name_exo_giveup
          !endif
        </div>
        !if $jquery_defined!=yes
          <div class="oef_exo_renew">
            !set wims_ref_class=wims_button wims_secondary_button
            !set wims_ref_id=oef_renew
            !href $renewlink $wims_name_giveup
          </div>
        !else
          <p>$name_giveup_confirm</p>
        !endif
      </div>
    !endif _exam notin $wims_session

    $
    !if $qnum>1
      <div class="oef_serie_exo spacer">
        <span>$name_serie_exo</span>
        <ul class="wims_serie_bar inline">
          !for j=1 to $[$reply_cnt]
            <li class="wims_exo_done" title="$name_exo $j ($wims_name_exo_tried)">$j</li>
          !next
          <li class="wims_exo_todo" title="$name_exo $j">$[$reply_cnt+1]</li>
          !for j=$[$reply_cnt+2] to $qnum
            <li title="$name_exo $j ($wims_name_exo_untry)">$j</li>
          !next
        </ul>
      </div>
    !endif
  </div><!-- #oef_actions -->
!else status=waiting
  !if $error!=$empty
    <div class="wims_msg alert">
    !read oef/msg.phtml
    </div>
  !endif

  !read oef/answer.phtml

  !if $status!=$empty
    <div id="oef_actions">
      <div class="oef_serie_exo2 spacer">$name_serie_exo2
      $name_serie_new2
      <ul class="wims_serie_bar inline">
    !for j=1 to $[$reply_cnt]
      <li class="wims_exo_done" title="$name_exo $j ($wims_name_exo_tried)">$j</li>
    !next
      <li class="wims_next_exo" title="$name_serie_nextexo">
    !href cmd=next > $[$reply_cnt+1]
      </li>
    !for j=$[$reply_cnt+2] to $qnum
      <li title="$name_exo $j ($wims_name_exo_untry)">$j</li>
    !next
      </ul>
      </div> <!-- class oef_serie_exo2-->
      <div class="oef_buttons">
    !set wims_ref_class=wims_button
    !set wims_ref_id=oef_serie_nextexo
    !href cmd=next <span class="oef_serie_nextexo">$name_serie_nextexo</span>
    !if _exam notin $wims_session
      $wims_name_or
      !set wims_ref_class=wims_button wims_secondary_button
      !set wims_ref_id=oef_serie_renew
      !if $jquery_defined=yes
      !! Displays a Modal dialog box explaining what the "giveup" button will do.
      <script>
      /*<![CDATA[*/
        $$(function(jq){
          jq("#exo_giveup").dialog({
            autoOpen: false,
            modal: true,
            buttons: {
              "$wims_name_yes": function() {window.location = '?session=$session&$renewlink';},
              "$wims_name_no": function() {jq(this).dialog("close");}
            }
          });
          jq("#exo_giveup_opener").on("click", function() {
            jq("#exo_giveup").dialog("open");
          });
        });
      /*]]>*/
      </script>
      <button class="wims_button wims_secondary_button" type="button" data-toggle="exo_giveup" id="exo_giveup_opener">$wims_name_giveup</button>
      !endif jquery
      <div class="dropdown-pane wims_msg info small" id="exo_giveup" title="$wims_name_giveup" data-dropdown>
      <p>$name_serie_giveup</p>
      !if $jquery_defined!=yes
        <div class="oef_exo_renew">
        !set wims_ref_class=wims_button wims_secondary_button
        !set wims_ref_id=oef_renew
        !href $renewlink $wims_name_giveup
        </div>
      !endif jquery
    !endif not exam
     </div> <!-- id oef_button-->
  !else status
    <div id="oef_actions">
    !if $qnum>1
      !set wims_ref_class=wims_button
      !set wims_ref_id=oef_serie_renew
      !if $seedlastcnt < $seedrepeat and $module_score!=$empty and $module_score<9.8 and _exam notin $wims_session
        !set tmp=$(wims_name_thsheet[14]) $[$seedlastcnt+1]/$seedrepeat
      !else
        !set tmp=$name_exo_renew
      !endif
      !href $renewlink <span class="oef_serie_renew">$tmp</span>
  $
      !if $wims_sheet=$empty and ($wims_user=supervisor or $wims_class=$empty)
        !set wims_ref_class=wims_button wims_secondary_button
        !set wims_ref_id=oef_exo_intro
        <span class="oef_exo_intro">
        !href exo_Intro
        </span>
   $
      !endif
      !!</div><!-- id oef_buttons ???-->
    !else qnum=1
      <p class="renew_et_intro">
      !if $seedlastcnt < $seedrepeat and $module_score!=$empty and $module_score<9.8 and _exam notin $wims_session
        !set tmp=$(wims_name_thsheet[14]) $[$seedlastcnt+1]/$seedrepeat
      !else
        !set tmp=$name_exo_renew
      !endif
      !set wims_ref_class=wims_button
      !set wims_ref_id=oef_renew
      !href $renewlink <span class="oef_exo_renew">$tmp</span>
    $
      !if $wims_sheet=$empty and $oef_test!=yes and ($wims_user=supervisor or $wims_class=$empty)
        !set wims_ref_class=wims_button wims_secondary_button
        !set wims_ref_id=oef_exo_intro
        !href exo_Intro
   $
      !endif
      </p>
    !endif qnum
  !endif status
  </div><!-- id oef_action-->
!endif

!if $replydefaulted=yes
  <p id="oef_devel_mode">
  $name_devel_mode:
  !if $oef_default=yes
    $name_devel_warning
  !else
    !set wims_ref_class=wims_button wims_secondary_button
    !set wims_ref_id=oef_default
    !href cmd=config&oef_default=yes $name_devel_insert
    $
  !endif
  </p>
!endif

:endmain
<div id="oef_endhook">
  !read ./endhook.phtml
  !if _exam notin $wims_session and _check notin $wims_session
    !read oef/endhook.phtml
  !endif
</div>
!reset seedlastcnt
:end
</div> <!-- .oefform -->

!if $oef_anstype_css!=$empty
  <style>$oef_anstype_css</style>
!endif
<!--fin oef Main.phtml-->
!tail

!if debug iswordof $m_oefenv
  !reset module_score
!endif

