| … | |
… | |
| 37 | # Important Note: the following two sets of constants may seem similar |
37 | # Important Note: the following two sets of constants may seem similar |
| 38 | # but they are functionally and semantically different |
38 | # but they are functionally and semantically different |
| 39 | |
39 | |
| 40 | # these constants determine which fields belong to what type of record |
40 | # these constants determine which fields belong to what type of record |
| 41 | # IP RESTRICT |
41 | # IP RESTRICT |
| 42 | use constant SET_FIELDS => [qw(set_header hardcopy_header open_date due_date answer_date published restrict_ip assignment_type attempts_per_version version_time_limit versions_per_interval time_interval problem_randorder problems_per_page hide_score hide_work)]; |
42 | use constant SET_FIELDS => [qw(set_header hardcopy_header open_date due_date answer_date published restrict_ip relax_restrict_ip assignment_type attempts_per_version version_time_limit versions_per_interval time_interval problem_randorder problems_per_page hide_score hide_work)]; |
| 43 | use constant PROBLEM_FIELDS =>[qw(source_file value max_attempts)]; |
43 | use constant PROBLEM_FIELDS =>[qw(source_file value max_attempts)]; |
| 44 | use constant USER_PROBLEM_FIELDS => [qw(problem_seed status num_correct num_incorrect)]; |
44 | use constant USER_PROBLEM_FIELDS => [qw(problem_seed status num_correct num_incorrect)]; |
| 45 | |
45 | |
| 46 | # these constants determine what order those fields should be displayed in |
46 | # these constants determine what order those fields should be displayed in |
| 47 | use constant HEADER_ORDER => [qw(set_header hardcopy_header)]; |
47 | use constant HEADER_ORDER => [qw(set_header hardcopy_header)]; |
| … | |
… | |
| 53 | # homework assignments with all of the gateway parameters |
53 | # homework assignments with all of the gateway parameters |
| 54 | # FIXME: in the long run, we may want to let hide_score and hide_work be |
54 | # FIXME: in the long run, we may want to let hide_score and hide_work be |
| 55 | # FIXME: set for non-gateway assignments. right now (11/30/06) they are |
55 | # FIXME: set for non-gateway assignments. right now (11/30/06) they are |
| 56 | # FIXME: only used for gateways |
56 | # FIXME: only used for gateways |
| 57 | # IP RESTRICT |
57 | # IP RESTRICT |
| 58 | use constant SET_FIELD_ORDER => [qw(open_date due_date answer_date published restrict_ip assignment_type)]; |
58 | use constant SET_FIELD_ORDER => [qw(open_date due_date answer_date published restrict_ip relax_restrict_ip assignment_type)]; |
| 59 | # use constant GATEWAY_SET_FIELD_ORDER => [qw(attempts_per_version version_time_limit time_interval versions_per_interval problem_randorder problems_per_page hide_score hide_work)]; |
59 | # use constant GATEWAY_SET_FIELD_ORDER => [qw(attempts_per_version version_time_limit time_interval versions_per_interval problem_randorder problems_per_page hide_score hide_work)]; |
| 60 | use constant GATEWAY_SET_FIELD_ORDER => [qw(version_time_limit time_limit_cap attempts_per_version time_interval versions_per_interval problem_randorder problems_per_page hide_score hide_work)]; |
60 | use constant GATEWAY_SET_FIELD_ORDER => [qw(version_time_limit time_limit_cap attempts_per_version time_interval versions_per_interval problem_randorder problems_per_page hide_score hide_work)]; |
| 61 | |
61 | |
| 62 | # this constant is massive hash of information corresponding to each db field. |
62 | # this constant is massive hash of information corresponding to each db field. |
| 63 | # override indicates for how many students at a time a field can be overridden |
63 | # override indicates for how many students at a time a field can be overridden |
| … | |
… | |
| 149 | RestrictTo => "Restrict To", |
149 | RestrictTo => "Restrict To", |
| 150 | DenyFrom => "Deny From", |
150 | DenyFrom => "Deny From", |
| 151 | }, |
151 | }, |
| 152 | default => 'No', |
152 | default => 'No', |
| 153 | }, |
153 | }, |
|
|
154 | relax_restrict_ip => { |
|
|
155 | name => "Relax IP restrictions when?", |
|
|
156 | type => "choose", |
|
|
157 | override => "any", |
|
|
158 | choices => [qw( No AfterAnswerDate AfterVersionAnswerDate )], |
|
|
159 | labels => { |
|
|
160 | No => "Never", |
|
|
161 | AfterAnswerDate => "After set answer date", |
|
|
162 | AfterVersionAnswerDate => "(gw/quiz) After version answer date", |
|
|
163 | }, |
|
|
164 | default => 'No', |
|
|
165 | }, |
| 154 | assignment_type => { |
166 | assignment_type => { |
| 155 | name => "Assignment type", |
167 | name => "Assignment type", |
| 156 | type => "choose", |
168 | type => "choose", |
| 157 | override => "all", |
169 | override => "all", |
| 158 | choices => [qw( default gateway proctored_gateway )], |
170 | choices => [qw( default gateway proctored_gateway )], |
| … | |
… | |
| 395 | foreach my $field (@fieldOrder) { |
407 | foreach my $field (@fieldOrder) { |
| 396 | my %properties = %{ FIELD_PROPERTIES()->{$field} }; |
408 | my %properties = %{ FIELD_PROPERTIES()->{$field} }; |
| 397 | |
409 | |
| 398 | # IP RESTRICT |
410 | # IP RESTRICT |
| 399 | # we don't show the ip restriction option if there are |
411 | # we don't show the ip restriction option if there are |
| 400 | # no defined locations |
412 | # no defined locations, nor the relax_restrict_ip option |
|
|
413 | # if we're not restricting ip access |
| 401 | next if ( $field eq 'restrict_ip' && ! $numLocations ); |
414 | next if ( $field eq 'restrict_ip' && ! $numLocations ); |
|
|
415 | next if ($field eq 'relax_restrict_ip' && |
|
|
416 | ( ($forUsers && $userRecord->restrict_ip eq 'No') || |
|
|
417 | (! $forUsers && $globalRecord->restrict_ip eq 'No'))); |
| 402 | |
418 | |
| 403 | unless ($properties{type} eq "hidden") { |
419 | unless ($properties{type} eq "hidden") { |
| 404 | $output .= CGI::Tr({}, CGI::td({}, [$self->FieldHTML($userID, $setID, $problemID, $globalRecord, $userRecord, $field)])) . "\n"; |
420 | $output .= CGI::Tr({}, CGI::td({}, [$self->FieldHTML($userID, $setID, $problemID, $globalRecord, $userRecord, $field)])) . "\n"; |
| 405 | } |
421 | } |
| 406 | |
422 | |