!nocache
!! useful when one comes from modtool
!set wims_backslash_insmath=yes
!set proc=oef
!if robot isin $session
  !changeto content.html
!endif

!set test_data=!replace internal data/ by in $module_data
!set test_data=!defof title in datamodule/$test_data/INDEX
!if $test_data= and $module_data!=
  <p class="name_datamodule">
    <i>$name_datamodule</i>
  </p>
!endif


!! ------------------------------------- saisie des paramètres
!if $step=1
  $name_insert <span class="tt wims_fname">$smodule</span>

  <p>$name_choose_allexo</p>
  !form reply
    <fieldset class="property_fields blockcenter">
      <legend>$wims_title_title</legend>
      <div class="field box">
        <label for="picksheet">$name_choose</label>
        <select name="picksheet" id="picksheet">
        !for i=1 to $sheetcnt
          !set sh=!line $i of $sheets
          !set se=!item 1 of $sh
          !set ti=!item 2 to -1 of $sh
          !if $se=$sheetcnt
            <option value="$se" selected="selected">$wims_name_Sheet $se: $ti</option>
          !else
            <option value="$se">$wims_name_Sheet $se: $ti</option>
          !endif
        !next i
        </select>
      </div>
      !if $scoring=yes
        <div class="field box">
          <label for="require">$name_required</label>
          <select name="require" id="require">
            <option value="0">0</option>
            <option value="10" selected="selected">10</option>
            !for i=2 to $require_limit
              <option value="$[10*$i]">$[10*$i]</option>
            !next
          </select>
          <div class="formHelp">$name_repeat</div>
        </div>
        <div class="field box">
          <label for="weight">$name_weight</label>
          <input size="6" name="weight" value="$weight" id="weight">
          <div class="formHelp">$name_weight_hint</div>
        </div>
      !endif
    </fieldset>

    !!debut du menu voir intromenu.phtml
    !read oef/default
    !read oef/intromenu_series.phtml

    <div class="blockcenter" style="max-width:900px">
      !set wims_formselect_switch=onchange="toggle_select_options(this, {'no' : '#intromenu_nonexpert', 'yes' : '#intromenu_expert'})"
      !formselect expert_ list no,yes prompt $name_simplifiedmenu,$name_expertmenu
      !reset wims_formselect_switch
    </div>
    !!formradio expert_ list no prompt $name_simplifiedmenu
    !default expert_=no
    !read oef/intromenu_nonexpert.phtml
    !set wims_ref_id=expert_yes
    !!formradio expert_ list yes prompt $name_expertmenu
    !read oef/intromenu_expert.phtml

    !let tmp=!replace word expert by $ in $special_parm2
    !set tmp3=!replace internal intro_expert=yes by in $special_parm3
    <input type="hidden" name="intro_expert" value="yes">

    <div class="wimscenter wimsform">
      <input type="submit" value="$wims_name_Insert">
      <input type="hidden" name="step" value="2">
      <input type="hidden" name="job" value="$job">
    </div>
  !formend
  <div class="formHelp">
    $name_remarkseverity
    !read oef/helpseverity
  </div>
!endif

!! ---------------------------------------- écriture du bilan
!if $step=2
  !if $addexo>0
    <div class="wims_msg success">
      !if $addexo=1
        $name_endallexo
      !else
        $name_endallexos
      !endif
      <div class="tt">$iniparm</div>
    </div>
  !endif
  !if $notadd>0
    <div class="wims_msg info">
      !if $notadd=1
        $name_endallexo2
      !else
        $name_endallexo2s
      !endif
      <ul>
      !for exo in $listalready
        !let num=!positionof item $exo in $exolist
        <li>$(exotitle[$num])</li>
      !next exo
      </ul>
    </div>
  !endif
  !set wims_menu_items=!append line sheetcheck,1, module=adm/class/sheet&sheet=$picksheet\
to $wims_menu_items
!endif

<script src="scripts/js/interface/ui_utils.js"></script>
<script>
  document.addEventListener("DOMContentLoaded", function(event) {
    // First init to have the proper intromenu hidden
    toggle_select_options(document.getElementById("expert_"), {'no' : '#intromenu_nonexpert', 'yes' : '#intromenu_expert'});
  });
</script>
