Subversion Repositories wimsdev

Rev

Rev 17681 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14537 guerimand 1
!! process for configfw : make general parameters of a freework
2
 
3
!! ---- make symbolic link to data file if needed
17780 czzmrn 4
!!
5
!! if wims_user=supervisor: the session dir contains
6
!!        getfile/freeworks with an "ln -s" $freework
7
!!                   pointing to $wims_class/freeworks/$freework
8
!!
9
!!        getfile/freeworksdata with an "ln -s" $freework
10
!!                   pointing to $wims_class/freeworksdata/$freework
11
!!
12
!! if wims_user!= supervisor: the session dir contains
13
!!        getfile/freeworskdata/$freework/work with an "ln -s" just
14
!!                   pointing to the user work
15
!!
16
!! this can create conflicts if a teacher in a groupment switches
17
!! from teacher to student (untested in portals): some cleaning might
18
!! be needed (cfr. var.proc)
19
!!
14537 guerimand 20
!if $type>1 and $activetest>0
14297 guerimand 21
  !sh cd $wims_home/$wims_sesdir;\
14572 bpr 22
    mkdir -p getfile;\
23
    cd getfile;\
24
    mkdir -p freeworksdata;\
25
    cd freeworksdata;\
26
    rm -f $freework;\
27
    ln -s $wims_home/log/classes/$wims_class/freeworksdata/$freework $freework;
14297 guerimand 28
!endif
29
 
17639 czzmrn 30
!! ---- access management
31
!read proc/access.proc
32
 
14297 guerimand 33
!if $save!=$empty and $job2=$empty
34
  success=goodsave
35
  !if $d2<=$d1
36
    warning=badsoldate
37
    !reset success
38
  !endif
39
  !if $freework>$nbfreework
14936 guerimand 40
    !bound scoring within 0,no default no
14297 guerimand 41
    update_content=0\
42
$class_expiration\
43
$title\
44
$desc\
45
$comment\
46
$type\
47
$deadline.$timedeadline\
48
$soldate.$timesoldate\
14339 guerimand 49
$sizelimitfile\
14537 guerimand 50
$scoring\
51
 
14297 guerimand 52
    activetest=0
53
    !sh mkdir -p $wims_home/log/classes/$wims_class/freeworks/$freework;
54
    !if $type>=2
14572 bpr 55
      !sh mkdir -p $wims_home/log/classes/$wims_class/freeworksdata/$freework/work;\
14297 guerimand 56
        mkdir -p $wims_home/log/classes/$wims_class/freeworksdata/$freework/co;
57
    !endif
58
  !else
59
    olddata=!record $freework of wimshome/log/classes/$wims_class/freeworks/.freeworks
17593 czzmrn 60
    !distribute line $olddata into activetest,bl,old_title,old_desc,old_comment,old_type,old_deadline,old_soldate,old_sizelimitfile,old_scoring,old_seealltime,old_studentclose
14889 guerimand 61
    !if $activetest>=2 or $warning=badsoldate
62
      soldate=!char 1 to 8 of $old_soldate
63
      timesoldate=!char 10 to 14 of $old_soldate
64
    !endif
14297 guerimand 65
    !if $activetest>=1
66
      deadline=!char 1 to 8 of $old_deadline
67
      timedeadline=!char 10 to 14 of $old_deadline
68
      sizelimitfile=$old_sizelimitfile
14537 guerimand 69
      seealltime=$old_seealltime
17593 czzmrn 70
      studentclose=$old_studentclose
14537 guerimand 71
      scoring=$old_scoring
14936 guerimand 72
    !else
73
      !if $old_scoring!=0 and $old_scoring!=no
74
        !if $scoring=no
75
          scoring=$[-abs($old_scoring)]
76
        !else
77
          scoring=$[abs($old_scoring)]
78
        !endif
79
      !else
80
        !bound scoring within 0,no default $old_scoring
81
      !endif
14297 guerimand 82
    !endif
14537 guerimand 83
    !bound seealltime between 0 and 1 default 0
17593 czzmrn 84
    !bound studentclose between 0 and 1 default 0
14297 guerimand 85
    update_content=$activetest\
86
$class_expiration\
87
$title\
88
$desc\
89
$comment\
90
$type\
91
$deadline.$timedeadline\
92
$soldate.$timesoldate\
14339 guerimand 93
$sizelimitfile\
14537 guerimand 94
$scoring\
17593 czzmrn 95
$seealltime\
96
$studentclose
14297 guerimand 97
  !endif
98
  update_field=$freework
17634 czzmrn 99
  update_nbline=$fw_nbline
14297 guerimand 100
 
101
  !read adm/uprecord wimshome/log/classes/$wims_class/freeworks/.freeworks
102
  !reset save
103
  nbfreework=!recordcnt wimshome/log/classes/$wims_class/freeworks/.freeworks
104
  name_title=$name_managefreework
14960 guerimand 105
  !readproc proc/mkglobalvar.proc
14297 guerimand 106
!endif
107
 
108
!! ---- job to add file to solution or subject
109
!for val in subject,solution
14537 guerimand 110
  !reset conditiontest
14297 guerimand 111
  !if $val=subject
14537 guerimand 112
    !if $activetest=0
113
      conditiontest=1
114
    !endif
14297 guerimand 115
  !else
14537 guerimand 116
    conditiontest=$putworkco
14297 guerimand 117
  !endif
118
  !if $job2=deposit$val and $wims_deposit!=$empty \
14537 guerimand 119
and / notin $wims_deposit and .. notin $wims_deposit and noname.file!=$wims_deposit
14297 guerimand 120
   !read proc/checkfilename.proc
121
   !if $error!=$empty
122
     !exit
123
   !endif
124
   success=goodaddfile
14537 guerimand 125
   !ifval $conditiontest!=1
14297 guerimand 126
      error=badstatut$val
127
      !reset success
128
   !else
129
      !sh mkdir -p $wims_home/log/classes/$wims_class/freeworks/$freework;\
130
          mv $wims_home/$wims_sesdir/user-deposit $wims_home/log/classes/$wims_class/freeworks/$freework/$newfilename
131
      !readproc adm/class/quotafree.proc proc
132
      !if $quota_free<0
133
        !sh rm -f $wims_home/log/classes/$wims_class/freeworks/$freework/$newfilename
134
        error=quota_file
135
        !reset success
136
      !else
14537 guerimand 137
        !default field_$val=$[$nb+1]
138
        update_field=$(field_$val)
139
        !if $newfilename notitemof $(flist$val)
140
          flist$val=!append item $newfilename to $(flist$val)
141
          update_content=!items2lines $(flist$val)
14313 guerimand 142
          update_content=!nonempty line $update_content
14537 guerimand 143
          update_content=$val\
144
$update_content
14313 guerimand 145
          !read adm/uprecord wimshome/log/classes/$wims_class/freeworks/.freework$freework
146
        !endif
14297 guerimand 147
      !endif
148
    !endif
14796 guerimand 149
    !reset job2
14297 guerimand 150
  !endif
151
!next val
152
 
14537 guerimand 153
!!------  job to erase file
154
!reset eraselist
155
!if $putworkco=1
14297 guerimand 156
  !if $activetest=0
157
    eraselist=!append item $flistsubject to $flistsolution
158
    eraselist=!listuniq $eraselist
159
  !else
160
    eraselist=$flistsolution
14537 guerimand 161
    eraselist=!listcomplement $flistsubject in $eraselist
14297 guerimand 162
  !endif
14796 guerimand 163
  !if $job2 isitemof erasesubject,erasesolution and $namefile!=$empty
164
    namefile=!listintersect $namefile and $eraselist
14297 guerimand 165
    !sh rm -f $wims_home/log/classes/$wims_class/freeworks/$freework/$namefile
14537 guerimand 166
    !for val in subject,solution
167
      !if $namefile isitemof $(flist$val)
168
        flist$val=!listcomplement $namefile in $(flist$val)
169
        update_field=$(field_$val)
170
        update_content=!items2lines $(flist$val)
171
        update_content=!nonempty line $update_content
172
        update_content=$val\
173
$update_content
174
        !read adm/uprecord wimshome/log/classes/$wims_class/freeworks/.freework$freework
175
      !endif
176
    !next val
14297 guerimand 177
    success=gooderasefile
14537 guerimand 178
    eraselist=!listcomplement $namefile in $eraselist
14796 guerimand 179
    !reset job2
14297 guerimand 180
  !endif
181
!endif
14537 guerimand 182
 
183
!! ---- manage file of the freework
184
!read adm/class/quotafree.proc proc
185
 
16554 guerimand 186
!if $codownload=1
187
  !readproc wimshome/log/classes/$wims_class/freeworksdata/$freework/.seeco
188
!endif
189
 
17681 czzmrn 190
!if $studentclose=1 and $activetest>0
17598 czzmrn 191
  !if $job2=reopen and $quser!=$empty and $now<$d1
192
    !setdef freework_closeco_$quser=$empty in wimshome/log/classes/$wims_class/freeworksdata/$freework/.closeco
17681 czzmrn 193
    !reset job2 quser
17598 czzmrn 194
  !endif
17593 czzmrn 195
  !readproc wimshome/log/classes/$wims_class/freeworksdata/$freework/.closeco
196
!endif
197
 
16087 guerimand 198
!if $type>=3
14537 guerimand 199
  !read proc/freeworkdata$(lpara_type[$type]).proc
200
!endif
201
 
14297 guerimand 202
!readproc proc/iserasable.proc $freework
17780 czzmrn 203
!read tabletheme