Subversion Repositories wimsdev

Rev

Rev 9436 | Rev 12238 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9436 Rev 12236
Line 3... Line 3...
3
max_exos=!defof MAX_EXOS in wimshome/public_html/bases/sys/define.conf
3
max_exos=!defof MAX_EXOS in wimshome/public_html/bases/sys/define.conf
4
max_sheets=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
4
max_sheets=!defof MAX_SHEETS in wimshome/public_html/bases/sys/define.conf
5
title_limit=50
5
title_limit=50
6
desc_limit=255
6
desc_limit=255
7
!if $scoring=yes
7
!if $scoring=yes
8
 !default require=10
8
  !default require=10
9
 !default weight=1
9
  !default weight=1
10
!else
10
!else
11
 require=0
11
  require=0
12
 weight=0
12
  weight=0
13
!endif
13
!endif
14
 
14
 
15
!if $cmd=new or $cmd=resume
15
!if $cmd=new or $cmd=resume
16
 sheets=
16
  sheets=
17
 !for i=1 to $sheettot
17
  !for i=1 to $sheettot
18
  sh=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
18
    sh=!record $i of wimshome/log/classes/$wims_class/sheets/.sheets
19
  !distribute lines $sh into a_,t_,title
19
    !distribute lines $sh into a_,t_,title
20
  !if $a_<1
20
    !if $a_<1
21
   sheets=!append line $i,$title to $sheets
21
      sheets=!append line $i,$title to $sheets
-
 
22
    !endif
-
 
23
  !next i
-
 
24
  sheetcnt=!linecnt $sheets
-
 
25
  !ifval $sheetcnt=0
-
 
26
    error=no_sheet
-
 
27
    !exit
-
 
28
  !endif
-
 
29
  test_transl=!module translation_language $dir
-
 
30
  !if $lang iswordof $test_transl
-
 
31
    tr_lang=yes
-
 
32
    title=!module title_$lang $dir
-
 
33
    desc=!module description_$lang $dir
-
 
34
  !endif
-
 
35
  !read getparm $iniparm exo
-
 
36
  desc=!lookup $get_exo in wimshome/public_html/modules/$dir/Descindex
-
 
37
  obs=!lookup $get_exo in wimshome/public_html/modules/$dir/Obsindex
-
 
38
  !default title=!module title $dir
-
 
39
  !default desc=!module description $dir
-
 
40
  cat=!module category $dir
-
 
41
  !if exercise notin $cat and oef notin $cat
-
 
42
    error=not_exo
-
 
43
    !exit
22
  !endif
44
  !endif
23
 !next i
-
 
24
 sheetcnt=!linecnt $sheets
-
 
25
 !ifval $sheetcnt=0
-
 
26
  error=no_sheet
-
 
27
  !exit
-
 
28
 !endif
-
 
29
 test_transl=!module translation_language $dir
-
 
30
 !if $lang iswordof $test_transl
-
 
31
   tr_lang=yes
-
 
32
   title=!module title_$lang $dir
-
 
33
   desc=!module description_$lang $dir
-
 
34
 !endif
-
 
35
 !read getparm $iniparm exo
-
 
36
 desc=!lookup $get_exo in wimshome/public_html/modules/$dir/Descindex
-
 
37
 obs=!lookup $get_exo in wimshome/public_html/modules/$dir/Obsindex
-
 
38
 !default title=!module title $dir
-
 
39
 !default desc=!module description $dir
-
 
40
 cat=!module category $dir
-
 
41
 !if exercise notin $cat and oef notin $cat
-
 
42
  error=not_exo
-
 
43
  !exit
45
  !exit
44
 !endif
-
 
45
 !exit
-
 
46
!endif
46
!endif
47
 
47
 
48
!if $cmd=reply
48
!if $cmd=reply
49
 !if ../adm/ isin ../$dir or $dir=home or \
49
  !if ../adm/ isin ../$dir or $dir=home or \
50
   (../devel/ isin ../$dir and $wims_devel_modules notwordof open)
50
   (../devel/ isin ../$dir and $wims_devel_modules notwordof open)
51
  error=insert_fail
51
    error=insert_fail
52
  !exit
-
 
53
 !endif
-
 
54
 !if $picksheet=$empty
-
 
55
  error=no_pick
-
 
56
  !exit
-
 
57
 !endif
-
 
58
 picksheet=$[floor($picksheet)]
-
 
59
 !if $picksheet=NaN or $picksheet<1 or $picksheet>min($max_sheets,$sheettot)
-
 
60
  error=bad_sheet
-
 
61
  !exit
-
 
62
 !endif
-
 
63
 sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
-
 
64
 a=!line 1 of $sh
-
 
65
 !if $a>0
-
 
66
  error=bad_sheet
-
 
67
  !exit
-
 
68
 !endif
-
 
69
 exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
-
 
70
 !if $exocnt>=$max_exos
-
 
71
  error=too_many_exos
-
 
72
  !exit
52
    !exit
73
 !endif
-
 
74
 idesc=!singlespace $new_desc
-
 
75
 idesc=!char 1 to $desc_limit of $idesc
-
 
76
 iobs=!singlespace $obs
-
 
77
 iobs=!char 1 to $desc_limit of $iobs
-
 
78
 ititle=!singlespace $title
-
 
79
 ititle=!char 1 to $title_limit of $ititle
-
 
80
 !if $scoring=yes
-
 
81
  require=$[$require]
-
 
82
  weight=$[$weight]
-
 
83
  !if NaN isin $require
-
 
84
   require=0
-
 
85
  !endif
53
  !endif
-
 
54
  !if $picksheet=$empty
-
 
55
    error=no_pick
-
 
56
    !exit
-
 
57
  !endif
-
 
58
  picksheet=$[floor($picksheet)]
-
 
59
  !if $picksheet=NaN or $picksheet<1 or $picksheet>min($max_sheets,$sheettot)
-
 
60
    error=bad_sheet
-
 
61
    !exit
-
 
62
  !endif
-
 
63
  sh=!record $picksheet of wimshome/log/classes/$wims_class/sheets/.sheets
-
 
64
  a=!line 1 of $sh
-
 
65
  !if $a>0
-
 
66
    error=bad_sheet
-
 
67
    !exit
-
 
68
  !endif
-
 
69
  exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
-
 
70
  !if $exocnt>=$max_exos
-
 
71
    error=too_many_exos
-
 
72
    !exit
-
 
73
  !endif
-
 
74
  idesc=!singlespace $new_desc
-
 
75
  idesc=!char 1 to $desc_limit of $idesc
-
 
76
  iobs=!singlespace $obs
-
 
77
  iobs=!char 1 to $desc_limit of $iobs
-
 
78
  ititle=!singlespace $title
-
 
79
  ititle=!char 1 to $title_limit of $ititle
-
 
80
  !if $scoring=yes
-
 
81
    require=$[$require]
-
 
82
    weight=$[$weight]
-
 
83
    !if NaN isin $require
-
 
84
      require=0
-
 
85
    !endif
86
  !if NaN isin $weight
86
    !if NaN isin $weight
87
   weight=0
87
      weight=0
-
 
88
    !endif
-
 
89
    !bound require between 0,$[10*$require_limit] default 0
-
 
90
    !bound weight between 0,10 default 0
88
  !endif
91
  !endif
89
  !bound require between 0,$[10*$require_limit] default 0
-
 
90
  !bound weight between 0,10 default 0
-
 
91
 !endif
-
 
92
 !for i=1 to $exocnt
92
  !for i=1 to $exocnt
93
  e=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
93
    e=!record $i of wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
94
  !distribute lines $e into wdi,win
94
    !distribute lines $e into wdi,win
95
  !if $dir=$wdi and $iniparm=$win
95
    !if $dir=$wdi and $iniparm=$win
96
   test=$picksheet
96
      test=$picksheet
97
   error=already_exist
97
      error=already_exist
98
   !exit
98
      !exit
99
  !endif
99
    !endif
100
 !next i
100
  !next i
101
####
101
####
102
  !if $get_random=0
102
  !if $get_random=0
103
  !for i=1 to $get_qnum
103
    !for i=1 to $get_qnum
104
    update_order=!append item $(update_ex$i) to $update_order
104
      update_order=!append item $(update_ex$i) to $update_order
105
  !next
105
    !next
106
 
106
 
107
  get_exo=$(get_exo[$update_order])
107
    get_exo=$(get_exo[$update_order])
108
  iniparm2=!replace internal & by $\
108
    iniparm2=!replace internal & by $\
109
$ in $iniparm
109
$ in $iniparm
110
  iniparm2_cnt=!linecnt $iniparm2
110
    iniparm2_cnt=!linecnt $iniparm2
111
  new_iniparm=
111
    new_iniparm=
112
  equal==
112
    equal==
113
  !for v in $get_exo
113
    !for v in $get_exo
114
    new_iniparm=!append item exo=$v to $new_iniparm
114
      new_iniparm=!append item exo=$v to $new_iniparm
115
  !next
115
    !next
116
  !for u=1 to $iniparm2_cnt
116
    !for u=1 to $iniparm2_cnt
117
    l=!line $u of $iniparm2
117
      l=!line $u of $iniparm2
118
    !if exo$equal notin $l
118
      !if exo$equal notin $l
119
     new_iniparm=!append item $l to $new_iniparm
119
        new_iniparm=!append item $l to $new_iniparm
120
    !endif
120
      !endif
121
  !next
121
    !next
122
  new_iniparm=!nospace $new_iniparm
122
    new_iniparm=!nospace $new_iniparm
123
  new_iniparm=!replace internal , by & in $new_iniparm=
123
    new_iniparm=!replace internal , by & in $new_iniparm=
124
  iniparm=$new_iniparm
124
    iniparm=$new_iniparm
125
!endif
125
  !endif
126
#####
126
#####
127
 !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$picksheet :$dir\
127
  !appendfile wimshome/log/classes/$wims_class/sheets/.sheet$picksheet :$dir\
128
$iniparm\
128
$iniparm\
129
$require\
129
$require\
130
$weight\
130
$weight\
131
$ititle\
131
$ititle\
132
$idesc\
132
$idesc\
133
\
133
\
134
$iobs
134
$iobs
135
 
135
 
136
 exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
136
  exocnt=!recordcnt wimshome/log/classes/$wims_class/sheets/.sheet$picksheet
137
 wims_module_log=class $class: add No$exocnt to worksheet $picksheet
137
  wims_module_log=class $class: add No$exocnt to worksheet $picksheet
138
!endif
138
!endif