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