Subversion Repositories wimsdev

Rev

Rev 14113 | Rev 14198 | 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_
14128 guerimand 12
!! line number containt score dependancy (not same for exam and sheet)
14105 guerimand 13
!if $type_=sheet
14
  li_=7
15
!else
14109 guerimand 16
  li_=4
14105 guerimand 17
!endif
18
ecnt_=!recordcnt wimshome/log/classes/$wims_class/$(type_)s/.$(type_)$num_
19
!for e_=1 to $ecnt_
20
  field_$e_=!record $e_ of wimshome/log/classes/$wims_class/$(type_)s/.$(type_)$num_
21
  field_$e_=!line 1 to 10 of $(field_$e_)\
22
\
23
\
24
\
25
\
26
\
27
\
28
 
29
!next e_
30
list_=!values v for v=1 to $ecnt_
31
list_=!replace item number $source_ by $empty in $list_
32
!if $target_!=$empty
33
  !if $target_=0
34
    list_=$source_,$list_
35
  !else
14113 guerimand 36
    !if $target_=$[$ecnt_+1]
37
      list_=$list_,$source_
38
    !else
14128 guerimand 39
      list_=!replace item $target_ by $source_,$target_ in $list_
14113 guerimand 40
    !endif
14105 guerimand 41
  !endif
42
!endif
43
list_=!nonempty item $list_
44
mlist_=$empty
45
!for i_=1 to $ecnt_
46
  p_=!positionof item $i_ in $list_
47
  !if $p_=$empty
48
    p_=EMPTY
49
  !endif
50
  mlist_=!append item $p_ to $mlist_
51
!next i_
52
ecnt_=!itemcnt $list_
53
!writefile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ $empty
54
!for e_=1 to $ecnt_
55
  !! ------- check for score dependancy
56
  sco_=!line $li_ of $(field_$(list_[$e_]))
57
  !if $sco_!=$empty
58
    nsco_=$empty
59
    sco_=!items2lines $sco_
60
    sco_=!replace internal : by , in $sco_
61
    sco_=!replace internal + by , in $sco_
62
    nbl_=!linecnt $sco_
63
    !for i_=1 to $nbl_
64
      nbi_=!itemcnt $(sco_[$i_;])
65
      nli_=$empty
66
      !for j_=1 to $nbi_-1
67
        !if $(mlist_[$(sco_[$i_;$j_])])!=EMPTY
68
          nli_=!append item $(mlist_[$(sco_[$i_;$j_])]) to $nli_
69
        !endif
70
      !next j_
71
      nli_=!nonempty item $nli_
72
      nli_=!replace internal , by + in $(nli_)
73
      !if $nli_!=$empty
74
        nli_=$nli_:$(sco_[$i_;$nbi_])
75
        nsco_=!append item $nli_ to $nsco_
76
      !endif
77
    !next i_
78
    field_$(list_[$e_])=!replace line number $li_ by $nsco_ in $(field_$(list_[$e_]))
79
  !endif
80
  !! save field
81
  !appendfile wimshome/log/classes/$wims_class/$(type_)s/.$type_$num_ :$(field_$(list_[$e_]))
82
!next e_