!nocache
!if $special_parm!=$empty
  !set exo=$special_parm
!endif

!if $exo=__user__ and select iswordof $special_parm2
  !if $wims_user!=$empty and $wims_user!=supervisor
    !set test=$wims_user.
    !goto dir
  !else
    !reset exo
  !endif
!endif
!if $exo!=$empty
  !if select iswordof $special_parm2
    !set oldparm=$exo
    !set test=!lower $exo
    !set test=!deaccent $test
    !set test=!text select abcdefghijklmnopqrstuvwxyz1234567890 $ in $test
    !set test=!singlespace $test
    !set test=!trim $test
:dir
    !reset elist,vlist
    !set tlist=!lower $titlelist
    !set tlist=!deaccent $tlist
    !set tlist=!text select abcdefghijklmnopqrstuvwxyz1234567890 , in $tlist
    !set tlist=!singlespace $tlist
    !for i=0 to $exocnt
      !set n_=!item $i of $exolist
      !set t_=!item $i of $tlist
      !if $test isin $t_ $n_
        !set elist=!append item $n_ to $elist
        !set t_=!item $i of $titlelist
        !set vlist=!append item $t_ to $vlist
      !endif
    !next i
    !if $elist!=$empty
      !set exolist=$elist
      !set titlelist=$vlist
      <input type="hidden" name="defaultlist" value="$elist">
    !endif
  !else
    !set exolist=!listuniq $exolist
    !set exolist=!replace , by , $ in $exolist
    !if $class_header!=wimshome/log/classes/$wims_class/
      !if $class_header!=
        !set dictionary=scripts/$(class_header)Extitles
      !else
        !set dictionary=$module_dir/$(class_header)Extitles
      !endif
    !else
      !set dictionary=$wims_home/log/classes/$wims_class/Extitles
    !endif
    !set translator_unknown=leave
    !set titlelist=!exec translator $exolist
  !endif
!endif
!!set ecnt=!itemcnt $exolist
!if $lang notsametext $module_language and $(titlelist_$lang) notsametext $empty
  !set titlelist=$(titlelist_$lang)
!endif
!if select notwordof $special_parm2 or $special_parm issametext $empty
  <label for="exo">$name_chooseexo:</label>
!endif
!set wims_formselect_switch=multiple="multiple" size="$qcnt"
!formselect exo list $exolist prompt $titlelist
!reset wims_formselect_switch

!if $exocnt>2 and $jquery_defined=yes
  <ul class="oef_filter">
    <li>
      <label for="selectorForExo">$name_select_auto:</label>
      <input type="search" results="5" id="selectorForExo" value="$special_parm" placeholder="$name_select_placeholder">
    </li>
  </ul>
  <script src="scripts/js/interface/jQuery.selectFilters.js"></script>
  <script>
    /*<![CDATA[*/
    $$(function() {
      $$('#exo').selectByText($$('#selectorForExo'));
    });
  /*]]>*/
  </script>
!endif
