!! html for create a individual class copying an exemple class

!if $step=-3
<div class="wims_content">
!if $keyword!=$empty
  !let s=open
!endif
<details $s>
  <summary>$name_clonebyclass</summary>
  !read proc/search.phtml
  <p>$name_clickclone</p>
  !if $debcls!=$empty
    !set table_id=TABLE_clonelist
    !set table_class=sortable
    $table_header
    <thead>
    $table_hdtr<th scope="col">$wims_name_name</th><th scope="col">$wims_name_supervisor</th>
    <th scope="col">$name_cloning</th>
    </thead>
    <tbody>
    !for i=$debcls to $ccnt
      !! find if classe is clonable
      !let l=!record $i of wimshome/log/classes/.index
      !distribute items $l into code,expire,inst,cl,la,ty
      !if $ty!=4
        !let l1=!deaccent $l
        !let l1=!tolower $l1
        !let c1=!text extract 0123456789 in $code
        !let k=yes
        !if $kw!=$empty
          !for w in $kw
            !if $w notin $l1
              !let k=no
              !break
            !endif
          !next w
        !endif
        !if $k=no and $ty=2 and $kw!=$empty
          !! find of keyword in subclasses
          !let sbcnt=!recordcnt wimshome/log/classes/$code/.subclasses
          !let sb=1
          !while $sb<=$sbcnt and $k=no
            !let ksb=yes
            !let l1sb=!record $sb of wimshome/log/classes/$code/.subclasses
            !let l1sb=!deaccent $l1sb
            !let l1sb=!tolower $l1sb

            !for w in $kw
              !if $w notin $l1sb
                !let ksb=no
                !break
              !endif
            !next w
            !if $ksb=yes
              !let k=yes
            !endif
            !increase sb
          !endwhile
        !endif
        !if $k!=yes
          !reset l
        !endif
      !else
        !reset l
      !endif
      !! display clonable class
      !if $l!=$empty
        !distribute items $l into code,expire,inst,cl,la,ty,b,b,first,last
        !let testneighbors=!defof sharing_all in wimshome/log/classes/$code/neighbors
        !let test=!defof class_allowcloning in wimshome/log/classes/$code/.def
        !if ($testneighbors=$empty and $test=yes) or ($code<=9999 and $code notin $noopenclone) or $ty=2
          !if $ty!=2
            $table_tr
            <td>$inst <br>
            !href cmd=reply&step=-2&sourcecls=$code $cl
            !if $class_info!=$empty
              <br> $class_info
            !endif
            </td>
            <td>$first $last</td>
            <td>
            !if $code<=9999
              $name_free
            !else
              !if $test=yes
                $name_protected
              !else
                $name_disallowed
              !endif
            !endif
            </td>
            </tr>
          !else
            !! class_type=2 display subclasses
            !let nbsubclass=!recordcnt wimshome/log/classes/$code/.subclasses
            !let auth=$empty
            !for j=1 to $nbsubclass
              !let tmp=!record $j of wimshome/log/classes/$code/.subclasses
              !let test=!defof class_allowcloning in wimshome/log/classes/$code/$j/.def
              !if $test=yes
                !let auth=!append item $j to $auth
              !endif
            !next j
            !if $auth!=$empty
              !for j in $auth
                !let tmp=!record $j of wimshome/log/classes/$code/.subclasses
                !distribute items $tmp into codes,expires,insts,cls,las,tys,b,b,firsts,lasts
                $table_tr
                <td>$name_subclass  $inst $cl <br>
                !href cmd=reply&step=-2&sourcecls=$codes $cls
                </td>
                <td>$firsts $lasts</td>
                <td>$name_protected</td>
                </tr>
              !next j
            !endif
          !endif
        !endif
      !endif
    !next i
    </tbody>
    $table_end
    !read tablesort.phtml
  !else
    $name_nofound
  !endif
</details>
<details>
  <summary>$(name_clonebytgz[1])</summary>
  !set wims_form_method=file
  !form reply
  <fieldset class="property_fields blockcenter">
    <legend>$(name_clonebytgz[2])</legend>
    <input type="hidden" name="job" value="cloneexemple">
    <div class="field box fullwidth">
        <label for="wims_deposit">$(name_clonebytgz[3])</label>
        <input type="hidden" name="step" value="-2">
        <input type="hidden" name="sourcecls" value="file">
        <input type="file" name="wims_deposit" id="wims_deposit" size="40">
    </div>
    <div class="wimscenter">
        <input type="submit" value="$wims_name_send">
    </div>
  </fieldset>
  !formend
</details>

</div>
!exit
!endif

!if $step=-2
  !! saisie du mot de passe de clonage pour les classes privées.
  $name_getcloningpwd
  !form reply
  <input size="20" name="clonepwd" value="$clonepwd" id="clonepwd">
  <input type="hidden" name="step" value="-1">
  <input type="submit" value="$wims_name_tosave">
  !formend
  !exit
!endif

!if $step>=-1 and $step<3
  <div class="wims_msg info">
  $name_cpexempleintro.
  !if $ssourcecls=file
    <br>
    $(name_clonebytgz[4])
  !endif
  </div>
!endif

!if $step=-1
  <div class="wims_content spacer">
  $(name_choosemode):
  <p>
  !set wims_ref_class=wims_button
  !href cmd=reply&methodecp=0&step=0 $name_btcpexemplemeth0
  $name_cpexemplemeth0
  </p><p>
  !set wims_ref_class=wims_button
  !href cmd=reply&methodecp=1&step=0 $name_btcpexemplemeth1
  $name_cpexemplemeth1
  </p>
  $name_cpexemplecomment

  !!  <span class="wims_warning">$wims_name_help</span>:
  !!  !read lang/help.phtml.$modu_lang 1
  </div>
  !exit
!endif

!if $step>=0
  !changeto proc/newclass.phtml
!endif
