Subversion Repositories wimsdev

Rev

Rev 14105 | Rev 14113 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14105 guerimand 1
!!
2
!! move a field of a .sheet$sheet or .exam$exam to another position
3
!! keep correct score dependancy
4
!! input parameter :
5
!! item 1 : word exam or word sheet (...)
6
!! item 2 : num of exam or sheet to be tranform
7
!! item 3 : the position where the field be inserted after (next are translated). if empty, the field is deleted if 0 the field is placed in first position
8
!! item 4 : the position of the source field 
9
!! wims_read_parm : name of record
10
 
11
!distribute item $wims_read_parm into type_,num_,target_,source_
12
!if $type_=sheet
13
  li_=7
14
!else
14109 guerimand 15
  li_=4
14105 guerimand 16
!endif
17
ecnt_=!recordcnt wimshome/log/classes/$wims_class/$(type_)s/.$(type_)$num_
18
!for e_=1 to $ecnt_
19
  field_$e_=!record $e_ of wimshome/log/classes/$wims_class/$(type_)s/.$(type_)$num_
20
  field_$e_=!line 1 to 10 of $(field_$e_)\
21
\
22
\
23
\
24
\
25
\
26
\
27
 
28
!next e_
29
list_=!values v for v=1 to $ecnt_
30
list_=!replace item number $source_ by $empty in $list_
31
!if $target_!=$empty
32
  !if $target_=0
33
    list_=$source_,$list_
34
  !else
35
    list_=!replace item $target_ by $target_,$source_ in $list_
36
  !endif
37
!endif
38
list_=!nonempty item $list_
39
mlist_=$empty
40
!for i_=1 to $ecnt_
41
  p_=!positionof item $i_ in $list_
42
  !if $p_=$empty
43
    p_=EMPTY
44
  !endif
45
  mlist_=!append item $p_ to $mlist_
46
!next i_
47
ecnt_=!itemcnt $list_
48
!writefile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ $empty
49
!for e_=1 to $ecnt_
50
  !! ------- check for score dependancy
51
  sco_=!line $li_ of $(field_$(list_[$e_]))
52
  !if $sco_!=$empty
53
    nsco_=$empty
54
    sco_=!items2lines $sco_
55
    sco_=!replace internal : by , in $sco_
56
    sco_=!replace internal + by , in $sco_
57
    nbl_=!linecnt $sco_
58
    !for i_=1 to $nbl_
59
      nbi_=!itemcnt $(sco_[$i_;])
60
      nli_=$empty
61
      !for j_=1 to $nbi_-1
62
        !if $(mlist_[$(sco_[$i_;$j_])])!=EMPTY
63
          nli_=!append item $(mlist_[$(sco_[$i_;$j_])]) to $nli_
64
        !endif
65
      !next j_
66
      nli_=!nonempty item $nli_
67
      nli_=!replace internal , by + in $(nli_)
68
      !if $nli_!=$empty
69
        nli_=$nli_:$(sco_[$i_;$nbi_])
70
        nsco_=!append item $nli_ to $nsco_
71
      !endif
72
    !next i_
73
    field_$(list_[$e_])=!replace line number $li_ by $nsco_ in $(field_$(list_[$e_]))
74
  !endif
75
  !! save field
76
  !appendfile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ :$(field_$(list_[$e_]))
77
!next e_