version 1.464, 2007/10/10 14:39:49
|
version 1.466, 2007/10/22 09:27:50
|
Line 631 sub callsub {
|
Line 631 sub callsub {
|
return $currentstring; |
return $currentstring; |
} |
} |
|
|
|
{ |
|
my %state; |
|
|
|
sub init_state { |
|
undef(%state); |
|
} |
|
|
|
sub set_state { |
|
my ($key,$value) = @_; |
|
$state{$key} = $value; |
|
return $value; |
|
} |
|
sub get_state { |
|
my ($key) = @_; |
|
return $state{$key}; |
|
} |
|
} |
|
|
sub setup_globals { |
sub setup_globals { |
my ($request,$target)=@_; |
my ($request,$target)=@_; |
$Apache::lonxml::request=$request; |
$Apache::lonxml::request=$request; |
Line 640 sub setup_globals {
|
Line 658 sub setup_globals {
|
$Apache::lonxml::usestyle=1; |
$Apache::lonxml::usestyle=1; |
&init_counter(); |
&init_counter(); |
&clear_bubble_lines_for_part(); |
&clear_bubble_lines_for_part(); |
|
&init_state(); |
@Apache::lonxml::pwd=(); |
@Apache::lonxml::pwd=(); |
@Apache::lonxml::extlinks=(); |
@Apache::lonxml::extlinks=(); |
@script_var_displays=(); |
@script_var_displays=(); |
Line 1047 Increments the internal counter environm
|
Line 1066 Increments the internal counter environm
|
Optional Arguments: |
Optional Arguments: |
$increment - amount to increment by (defaults to 1) |
$increment - amount to increment by (defaults to 1) |
Also 1 if the value is negative or zero. |
Also 1 if the value is negative or zero. |
$part_id - optional part id.. during analysis, this |
$response_id - The id of the response to record. This |
indicates whic part of a problem is being |
indicates whicn part of which problem is being |
counted. |
counted. |
|
|
=cut |
=cut |
|
|
sub increment_counter { |
sub increment_counter { |
my ($increment, $part_id) = @_; |
my ($increment, $response_id) = @_; |
if (!defined($increment) || $increment le 0) { |
if (!defined($increment) || $increment le 0) { |
$increment = 1; |
$increment = 1; |
} |
} |
$Apache::lonxml::counter += $increment; |
$Apache::lonxml::counter += $increment; |
|
|
# If the caller supplied the part_id parameter, |
# If the caller supplied the response_id parameter, |
# Maintain its counter.. creating if necessary. |
# Maintain its counter.. creating if necessary. |
|
|
if(defined($part_id)) { |
if(defined($response_id)) { |
if (!defined($Apache::lonxml::counters_per_part{$part_id})) { |
if (!defined($Apache::lonxml::counters_per_part{$response_id})) { |
$Apache::lonxml::counters_per_part{$part_id} = 0; |
$Apache::lonxml::counters_per_part{$response_id} = 0; |
} |
} |
$Apache::lonxml::counters_per_part{$part_id} += $increment; |
$Apache::lonxml::counters_per_part{$response_id} += $increment; |
my $new_value = $Apache::lonxml::counters_per_part{$part_id}; |
my $new_value = $Apache::lonxml::counters_per_part{$response_id}; |
} |
} |
|
|
$Apache::lonxml::counter_changed=1; |
$Apache::lonxml::counter_changed=1; |
Line 1129 sub store_counter {
|
Line 1148 sub store_counter {
|
|
|
=pod |
=pod |
|
|
=item bubble_lines_for_part(part_id) |
=item bubble_lines_for_part(response_id) |
|
|
Returns the number of lines required to get a response for |
Returns the number of lines required to get a response for |
$part_id (this is just $Apache::lonxml::counters_per_part{$part_id} |
$response_id (this is just $Apache::lonxml::counters_per_part{$response_id} |
|
|
=cut |
=cut |
|
|
sub bubble_lines_for_part { |
sub bubble_lines_for_part { |
my ($part_id) = @_; |
my ($response_id) = @_; |
|
|
if (!defined($Apache::lonxml::counters_per_part{$part_id})) { |
if (!defined($Apache::lonxml::counters_per_part{$response_id})) { |
return 0; |
return 0; |
} else { |
} else { |
return $Apache::lonxml::counters_per_part{$part_id}; |
return $Apache::lonxml::counters_per_part{$response_id}; |
} |
} |
|
|
} |
} |
Line 1163 sub clear_bubble_lines_for_part {
|
Line 1182 sub clear_bubble_lines_for_part {
|
|
|
=pod |
=pod |
|
|
=item set_bubble_lines(part_id, value) |
=item set_bubble_lines(response_id, value) |
|
|
If there is a problem part, that for whatever reason |
If there is a problem part, that for whatever reason |
requires bubble lines that are not |
requires bubble lines that are not |
Line 1173 analysis to set its hash value explicitl
|
Line 1192 analysis to set its hash value explicitl
|
=cut |
=cut |
|
|
sub set_bubble_lines { |
sub set_bubble_lines { |
my ($part_id, $value) = @_; |
my ($response_id, $value) = @_; |
|
|
$Apache::lonxml::counters_per_part{$part_id} = $value; |
$Apache::lonxml::counters_per_part{$response_id} = $value; |
} |
} |
|
|
=pod |
=pod |