Subversion Repositories wimsdev

Rev

Rev 14109 | Rev 14128 | 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
14113 guerimand 35
    !if $target_=$[$ecnt_+1]
36
      list_=$list_,$source_
37
    !else
38
      list_=!replace item $target_ by $target_,$source_ in $list_
39
    !endif
14105 guerimand 40
  !endif
41
!endif
42
list_=!nonempty item $list_
43
mlist_=$empty
44
!for i_=1 to $ecnt_
45
  p_=!positionof item $i_ in $list_
46
  !if $p_=$empty
47
    p_=EMPTY
48
  !endif
49
  mlist_=!append item $p_ to $mlist_
50
!next i_
51
ecnt_=!itemcnt $list_
52
!writefile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ $empty
53
!for e_=1 to $ecnt_
54
  !! ------- check for score dependancy
55
  sco_=!line $li_ of $(field_$(list_[$e_]))
56
  !if $sco_!=$empty
57
    nsco_=$empty
58
    sco_=!items2lines $sco_
59
    sco_=!replace internal : by , in $sco_
60
    sco_=!replace internal + by , in $sco_
61
    nbl_=!linecnt $sco_
62
    !for i_=1 to $nbl_
63
      nbi_=!itemcnt $(sco_[$i_;])
64
      nli_=$empty
65
      !for j_=1 to $nbi_-1
66
        !if $(mlist_[$(sco_[$i_;$j_])])!=EMPTY
67
          nli_=!append item $(mlist_[$(sco_[$i_;$j_])]) to $nli_
68
        !endif
69
      !next j_
70
      nli_=!nonempty item $nli_
71
      nli_=!replace internal , by + in $(nli_)
72
      !if $nli_!=$empty
73
        nli_=$nli_:$(sco_[$i_;$nbi_])
74
        nsco_=!append item $nli_ to $nsco_
75
      !endif
76
    !next i_
77
    field_$(list_[$e_])=!replace line number $li_ by $nsco_ in $(field_$(list_[$e_]))
78
  !endif
79
  !! save field
80
  !appendfile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ :$(field_$(list_[$e_]))
81
!next e_