!distribute items $wims_read_parm into i,j
!default j=1
!set seq_=!record $j of wimshome/log/classes/$wims_class/seq/.sequence$i
!distribute line $seq_ into tis_,cos_,obj_,o_
!if $o_<1
  !exit
!endif
!! TODO : maybe this line is already doing in the widget file _widgets/user_varsheet.phtml and
!! not needed here ?
!set wlist=!getscoreweight
!! --------
!set TI=!defof sequence_Title in wimshome/log/classes/$wims_class/seq/.def

<div id="wims_seq_$i" class="wims_seq">
!if $jquery_defined!=yes and $i > 1 and $seq=$empty
  !read themes/_widgets/topback.phtml wims_seq_summary
!endif
  <h2 class="wims_title_seq">
    <span class="wims_seq_id">$TI $i</span>
    <span class="wims_title_item">$tis_</span>
  </h2>
  <div class="wims_comment_item">$cos_</div>

!reset seq_item
!set tmp=!defof DF_SEVERITY in wimshome/public_html/bases/sys/define.conf
!distribute words $tmp into tmp_w,tmp_s,tmp_ss

<ul class="wims_work_list">
!set dcnt=!itemcnt $obj_
!set listc=!filelist $wims_home/log/classes/$wims_class/doc
!for i_=1 to $dcnt
  !distribute word $(obj_[$i_]) into type,num
  !if $type=c
    !set d_=!nospace $(obj_[$i_])
    !set num=!positionof line $d_ in $listc
    !set d_=!record $num of wimshome/log/classes/$wims_class/doc/.index
    !distribute lines $d_ into s_,t_,bidon,bidon,bidon,o_,bidon,bidon,de_
    !if $o_>0
      !increase seq_item
      <li class="wims_doc_item">
        <span class="wims_seq_item_n">$seq_item</span>
      !href module=adm/doc&job=read&doc=$s_&block=main&seq=$i $t_
        <div class="wims_doc_desc">$de_</div>
      </li>
    !endif
  !endif
  !if $type=doc
    !set d_=!record $num of wimshome/log/classes/$wims_class/doc/.docindex
    !distribute lines $d_ into s_,t_,ti_,de_,o_,w_
    !if $o_>0
      !increase seq_item
      <li class="wims_doc_item">
        <span class="wims_seq_item_n">$seq_item</span>
        !href module=$s_&$t_&seq=$i&name=$wims_name_sequence&wksheet=$w_ $ti_
        <div class="wims_doc_desc">$de_</div>
      </li>
    !endif
    !reset s_,t_,ti_,de_,o_
  !endif
  !if $type=tool
    !set d_=!record $num of wimshome/log/classes/$wims_class/tool/.toolindex
    !distribute lines $d_ into s_,t_,ti_,de_,o_,w_
    !if $o_>0
      !increase seq_item
      <li class="wims_tool_item">
        <span class="wims_seq_item_n">$seq_item</span>
      !href module=$s_&$t_&seq=$i&name=$wims_name_sequence&wksheet=$w_ $ti_
        <div class="wims_tool_desc">$de_</div>
      </li>
    !endif
    !reset s_,t_,ti_,de_,o_
  !endif
  !if $type=glossary
    !set d_=!record $num of wimshome/log/classes/$wims_class/tool/.glossaryindex
    !distribute lines $d_ into o_,t_,de_
    !if $o_>0
      !increase seq_item
      <li class="wims_glossary_item">
        <span class="wims_seq_item_n">$seq_item</span>
      !href module=adm/tool/glossary&seq=$i&gl=$num&name=$wims_name_sequence $t_
        <div class="wims_glossary_desc">$de_</div>
      </li>
    !endif
    !reset t_,o_
  !endif
  !if $type=sheet
    !reset hidden_sheet
    !set s_=!record $num of wimshome/log/classes/$wims_class/sheets/.sheets
    !set sevlist=!record 0 of wimshome/log/classes/$wims_class/sheets/.severity
    !distribute lines $s_ into a_,t_,ti,de,b,b,b,b,b,indivtechvar
    !set tmp_sheetstatus=!getsheetstatus sheet=$num
    !if $tmp_sheetstatus iswordof 1 2
      !set formula_list=!record 0 of adm/class/sheetformula
      !set scoremax=!line 1 of $sevlist
      !default scoremax=10
      !set sev_$num=!line $num + 1 of $sevlist
      !distribute word $(sev_$num) into w_$num,s,ss
      !bound s between integer 0 and 6 default $tmp_s
      !bound ss between integer 0 and 2 default $tmp_ss
      !set f_$num=!item $s+1 of $formula_list
      !set f_$num=!replace internal I by I$ss in $(f_$num)
      !set pe=!line $num of $percents
      !set try=!getscoretry sheet=$num
      !set try0=!text select 123456789 in $try
      !increase seq_item
      <li class="wims_sheet_item" id="sh$num">
        <span class="wims_seq_item_n">$seq_item</span>
      !href module=adm/sheet&sh=$num&seq=$i $ti
        <ul class="wims_sheet_info">
      !if showshweight iswordof $class_option
            <li class="wims_sheet_weight small">$wims_name_coeff <span class="sheet_weight_num">$(w_$num)</span></li>
      !endif
      !if $a_>=2
        <li class="wims_user_sheet_expire"><span class="wims_status wims_status_2">$U_expired</span></li>
      !else
        !if showshexpire iswordof $class_option
          <li class="wims_user_sheet_expire small">
          !read misc/expire.phtml.$lang $t_
          </li>
        !endif
      !endif
      </ul>
      <div class="wims_user_info">
      !if $try0!=$empty
        !distribute words $pe into p1,p2,p3,p4
        !distribute item $[$p1/100],$[$p2/10],$[$p3/100],$[$p4/100] into x0_,y_,x1_,x2_
        !set ff_$num=!mathsubst Q=$y_ in $(f_$num)
        !for sev=0 to 2
          !set ff_$num=!mathsubst I$sev=$(x$(sev)_) in $(ff_$num)
        !next
        <span class="wims_sheet_score">
        !!! adm/class/userscore/getuser.phtml
        !!! adm/class/userscore/csv/download.proc
        !!! themes/_widgets/usersheet.phtml
          $(wims_name_thsheet[9]): $[rint(100*$scoremax*$(ff_$num))/100]/$scoremax
        !!$(wims_name_thsheet[5]): $p1%,
        !!$(wims_name_thsheet[7]): $[$p2]/10,
        !!$(wims_name_thsheet[10]): $p3%,
        !!$(wims_name_thsheet[13]): $[$p4/10]/10
        </span>
      !endif
      </div>
      <div class="wims_sheet_desc">
      !set cut=!detag $de
      !set lim=100
      !set cut=!char 1 to $lim of $cut
      !set cutcnt=!wordcnt $cut
      !set cutchar=!charcnt $cut
      !if $cutchar = $lim
        !set cutlim=$[$cutcnt-1]
      !else
        !set cutlim=$[$cutcnt]
      !endif
      !word 1 to $cutlim of $cut
      !if $cutchar=$lim
        !set wims_ref_class=wims_button_help smaller
        !set wims_ref_title= Voir la description complete.
        !href module=adm/sheet&sh=$num&seq=$i [...]
      !endif
      </div><!--wims_sheet_desc-->
      !! ------ download techvarvalue for individual sheet
      !if $indivtechvar!=$empty
        !set indivtechval_$num=!defof user_techvar_$(indivtechvar) in $userdef
      !else
        !reset indivtechval_$num
      !endif
      !! ------ end individual sheet
      !read theme.phtml _widgets/userbar.phtml $num
      </li><!--wims_sheet_item-->
      !reset a_,t_,ti,de
    !endif
  !endif
  !if $type=vote
    !set v_=!record $num of wimshome/log/classes/$wims_class/vote/.votes
    !distribute lines $v_ into a_,t_
    !if $a_>=1 and $a_<=2
      !increase seq_item
      <li class="wims_vote_item">
        <span class="wims_seq_item_n">$seq_item</span>
      !href module=adm/vote&job=read&vote=$num&seq=$i $t_
      </li>
    !endif
    !reset a_,t_
  !endif
  !if $type=freework
    !set v_=!record $num of wimshome/log/classes/$wims_class/freeworks/.freeworks
    !distribute lines $v_ into a_,bl,t_,de,bl,bl,tt_
    !if $a_>=1 and $a_<=2
      !increase seq_item
      <li class="wims_freework_item">
        <span class="wims_seq_item_n">$seq_item</span>
      !href module=adm/class/freework&freework=$num&seq=$i $t_
        <div class="wims_freework_desc">$de</div>
        <ul class="wims_freework_info">
          <li class="wims_user_freework_expire small">
          !read misc/expire.phtml.$lang $tt_
          </li>
        </ul>
      </li>
    !endif
    !reset a_,t_,bl,de
  !endif
  !if $type=exam
    !reset hidden_sheet
    !set e_=!record $num of wimshome/log/classes/$wims_class/exams/.exams
    !distribute lines $e_ into a_,ex_,du_,title_,de_,bl,bl,h_
    !set tmp_sheetstatus=!getsheetstatus exam=$num
    !if $tmp_sheetstatus iswordof 1 2
      !increase seq_item
      <li class="wims_exam_item">
        <span class="wims_seq_item_n">$seq_item</span>
      !href module=adm/class/exam&exam=$num&seq=$i $title_
        <span class="wims_user_exam_expire">
      !if $a_>=2
        <span class="wims_status wims_status_2">$U_expired</span>
      !else
        !if showexexpire iswordof $class_option
          !read misc/expire.phtml.$lang $ex_
        !else
          &nbsp;
        !endif
      !endif
      </span>
      <div class="wims_exam_desc">$de_</div>
      !read theme.phtml _widgets/userexambar.phtml $num
    </li>
    !endif
    !reset a_,ex_,du_,nb_,title_,de_
  !endif

  !reset s_ v_ d_ e_
!next i_
</ul>
</div>
!reset tmp  tmp_w tmp_s tmp_ss
