!! generate link for action on freework in a class
!! wims_read_parm=linkmodule,freeworknumber,statutsheet,flag(after action 1 return to home 0 stay in linkmodule),typeoffreework

!distribute item $wims_read_parm into m_,sh_,st_,home_,ty_
!let exocnt_=!recordcnt wimshome/log/classes/$wims_class/freeworks/.freework$sh_
!if $home_=1
  !let li_=cmd=new&$m_=$sh_&back=$home_&module=adm/class/$(m_)
!else
  !let li_=cmd=reply&back=0
!endif

!if $st_=0
  !! ---- link for preparing mode
  !if $exocnt_>0
    !set wims_ref_class=wims_button
    !href $li_&job=prep_activate $(wims_name_actionlist[1])
    &nbsp;
  !endif
  !if $erasable=yes or ($sh_>$(min_$(m_)_erasable) and $home_=1)
    !set wims_ref_class=wims_button wims_warning
    !href $li_&job=prep_erase $(wims_name_actionlist[6])
    $
  !endif
!else
  !if $st_=1
    !! ---- link for active mode
    !set wims_ref_class=wims_button
    !href $li_&job=expire $(wims_name_actionlist[2])
    $
    !set wims_ref_class=wims_button wims_secondary_button
    !href $li_&job=deactivate $(wims_name_actionlist[3])
  !else
    !set wims_ref_class=wims_button
    !if $st_=2
      !href $li_&job=hide $(wims_name_actionlist[4])
    !else
      !href $li_&job=expire $(wims_name_actionlist[5])
    !endif
    $
    !let test_=!fileexists wimshome/log/classes/$wims_class/freeworksdata/$sh_/.archivated
    !if $test_!=yes
      !set wims_ref_class=wims_button
      !href $li_&job=reactivate $(wims_name_actionlist[1])
      !if $ty_>1
        $
        !set wims_ref_class=wims_button wims_secondary_button
        !href $li_&job=archive $(wims_name_actionlist[7])
      !endif
    !endif
  !endif
!endif
