
!if $error!=$empty
  !exit
!endif

!if $no_selection!=$empty
  <div class="wims_msg alert">
    <span class="wims_warning">$wims_name_warning</span>. $name_noselect
  </div>
!endif

!if $serial!=$wims_class and $old_testcnt>0
  !set test=bad
!endif

!if $test=bad
  <div class="wims_msg alert">
    <span class="wims_warning">$wims_name_warning!</span>
    !read lang/names.phtml.$moduclass_lang arch
  </div>
!endif

!form reply
  <input type="hidden" name="job" value="$job">
  <input type="hidden" name="job2" value="restore">
  $name_deposit
  <fieldset class="property_fields">
    <legend>$name_res_type</legend>
    <ul>
      <li>
        <input type="checkbox" name="selection" id="restore_all" value="all">
        <label for="restore_all">$name_all</label>
      </li>
      !if def isitemof $gotlist
        <li>
          <input type="checkbox" name="selection" id="restore_def" value="def">
          <label for="restore_def">$name_config. $name_danger.</label>
        </li>
      !endif
      !if sup isitemof $gotlist
        <li>
          !if $sharing_sup=$empty
            <input type="checkbox" name="selection" id="restore_sup" value="sup">
          !endif
            <label for="restore_sup">$name_teacher.</label>
          !if $sharing_sup!=$empty
            $name_no_restore
          !else
            $name_danger.
          !endif
        </li>
      !endif
      !let list=!listintersect user,doc,exo,sheet,exam,forum,motd,userphoto,tool,freework and $gotlist
      !for type in $list
        <li>
          !if $(sharing_$type)=$empty and $type notitemof $forbiddenlistdep
            <input type="checkbox" name="selection" id="restore_$type" value="$type">
          !endif
          <label for="restore_$type"><strong>$(new_$(type)cnt)</strong> $(name_$type).</label>
          !if $(sharing_$type)!=$empty
            $name_no_restore
          !else
            !if $type isitemof $forbiddenlistdep
              !if $type notitemof $forbiddenlist
                $name_dependance
              !else
                $name_limit_exceed
              !endif
            !else
              $(name_$(type)0)
              <span class="small">($(name_$(type)1) : $(old_$(type)cnt))</span>.
            !endif
          !endif
        </li>
      !next type
      !if score isitemof $gotlist
        <li>
          !if score notitemof $forbiddenlistdep
            <input type="checkbox" name="selection" id="restore_score" value="score">
          !endif
          <label for="restore_score">$name_activity</label>
          !if score isitemof $forbiddenlistdep
              !if score notitemof $forbiddenlist
                $name_dependance
              !else
                $name_limit_exceed
              !endif
          !endif
        </li>
      !endif
      !if manual isitemof $gotlist
        <li>
          !if manual notitemof $forbiddenlistdep
            <input type="checkbox" name="selection" id="restore_manual" value="manual">
          !endif
          <label for="restore_manual">$new_manualcnt $name_manual.</label>
          !if manual isitemof $forbiddenlistdep
              !if manual notitemof $forbiddenlist
                $name_dependance
              !else
                $name_limit_exceed
              !endif
          !else
            <span class="small">($name_manual1&nbsp;:
             $old_manualcnt)</span>.
          !endif
        </li>
      !endif
      !if cdt isitemof $gotlist
         <li>
           <input type="checkbox" name="selection" id="restore_cdt" value="cdt">
           <label for="restore_cdt">$name_cdt.</label>
           !if $old_cdtcnt>0
             <span class="small">($name_cdt1)</span>
           !endif
         </li>
      !endif
      !if livret isitemof $gotlist
        <li>
          !if livret notitemof $forbiddenlistdep
            <input type="checkbox" name="selection" id="restore_livret" value="livret">
          !endif
          <label for="restore_livret">$name_livret.</label>
          !if livret isitemof $forbiddenlistdep
              !if livret notitemof $forbiddenlist
                $name_dependance
              !else
                $name_limit_exceed
              !endif
          !else
            !if $old_livretcnt>0
              <span class="small">($name_livret1)</span>
            !endif
          !endif
        </li>
      !endif
      !if seq isitemof $gotlist
        <li>
          !if seq notitemof $forbiddenlistdep
            <input type="checkbox" name="selection" id="restore_seq" value="seq">
          !endif
          <label for="restore_seq">$name_seq.</label>
          !if seq isitemof $forbiddenlistdep
              !if seq notitemof $forbiddenlist
                $name_dependance
              !else
                $name_limit_exceed
              !endif
          !else
            $name_seq0
            <span class="small">($name_seq1 $old_seqcnt)</span>.
          !endif
        </li>
      !endif
    </ul>
  </fieldset>

  <fieldset class="property_fields">
    <legend>$name_method</legend>
    <ul>
      <li>
        <input type="radio" name="restore" id="method_merge" value="merge" checked="checked">
        <label for="method_merge">$name_merge</label>
        <div class="formHelp">$name_merge1.</div>
      </li>
      <li>
        <input type="radio" name="restore" id="method_replace" value="replace">
        <label for="method_replace">$name_replace</label>
        <div class="formHelp"><span class="wims_warning">$name_replace1.</span></div>
      </li>
    </ul>
  </fieldset>
  !!## TODO desactiver les feuilles s'il n'y pas de participant et enlever la date d'expiration?
  !!!if $(new_usercnt)=0
  !!   <input type="checkbox" name="preparation" value="no"> Mettre les feuilles en préparation
  !!!endif
  <div class="wimscenter">
    <input type="submit" value="$name_selectrestore">
    !set wims_ref_class=wims_button wims_secondary_button
    !href cmd=reply&job=new $wims_name_giveup
  </div>
!formend

<div class="wims_msg info">
  !read lang/names.phtml.$moduclass_lang arch_end
</div>
