!!##parameter 1: name of the file with extension
!!##parameter 2: words on the link, by default, name of the file

!if $parm1=$empty
  !exit
!endif
!set parm1=!slashsubst $parm1
!if $parm2=$empty
  !set parm2=$parm1
!else
  !set parm2=!slashsubst $parm2
!endif


!if $module_category=adm
!!  !set ext_=!replace internal . by , in $parm1
!!  !set ext_=!item -1 of $ext_
!!  !set ext_=!lowercase $ext_
!!  !if $ext_ notwordof jpeg jpg png gif pdf tex txt mp3 flv avi ggb ods rtf tgz zip
!!    !set ext_=cgi
!!  !endif
!!  !set ext_=cgi
!!  <a target="wims_external" href="wims.$ext_?session=$wims_session&cmd=getfile&special_parm=doc/$parm1" download="$parm1">$parm2</a>
  <a target="wims_external" href="wims.cgi?session=$wims_session&cmd=getfile&special_parm=doc/$parm1" download="$parm1">$parm2</a>
!else
  <a target="wims_external" href="$m_filedir/$parm1" download="$parm1">$parm2</a>
!endif
