version 1.378, 2006/04/20 04:30:11
|
version 1.384, 2006/05/30 12:46:09
|
Line 40 use Apache::lonnet;
|
Line 40 use Apache::lonnet;
|
use POSIX qw (floor strftime); |
use POSIX qw (floor strftime); |
use Data::Dumper; # for debugging, not always |
use Data::Dumper; # for debugging, not always |
use Time::HiRes qw( gettimeofday tv_interval ); |
use Time::HiRes qw( gettimeofday tv_interval ); |
|
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
# symbolic constants |
# symbolic constants |
sub SYMB { return 1; } |
sub SYMB { return 1; } |
Line 469 sub getLinkForResource {
|
Line 471 sub getLinkForResource {
|
my $anchor; |
my $anchor; |
if ($res->is_page()) { |
if ($res->is_page()) { |
foreach (@$stack) { if (defined($_)) { $anchor = $_; } } |
foreach (@$stack) { if (defined($_)) { $anchor = $_; } } |
$anchor=&Apache::lonnet::escape($anchor->shown_symb()); |
$anchor=&escape($anchor->shown_symb()); |
return ($res->link(),$res->shown_symb(),$anchor); |
return ($res->link(),$res->shown_symb(),$anchor); |
} |
} |
# in case folder was skipped over as "only sequence" |
# in case folder was skipped over as "only sequence" |
my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb()); |
my ($map,$id,$src)=&Apache::lonnet::decode_symb($res->symb()); |
if ($map=~/\.page$/) { |
if ($map=~/\.page$/) { |
my $url=&Apache::lonnet::clutter($map); |
my $url=&Apache::lonnet::clutter($map); |
$anchor=&Apache::lonnet::escape($src->shown_symb()); |
$anchor=&escape($src->shown_symb()); |
return ($url,$res->shown_symb(),$anchor); |
return ($url,$res->shown_symb(),$anchor); |
} |
} |
} |
} |
Line 1122 sub render_resource {
|
Line 1124 sub render_resource {
|
removeFromFilter($filter, $mapId); |
removeFromFilter($filter, $mapId); |
$linkopen .= "&condition=" . $it->{CONDITION} . '&hereType=' |
$linkopen .= "&condition=" . $it->{CONDITION} . '&hereType=' |
. $params->{'hereType'} . '&here=' . |
. $params->{'hereType'} . '&here=' . |
&Apache::lonnet::escape($params->{'here'}) . |
&escape($params->{'here'}) . |
'&jump=' . |
'&jump=' . |
&Apache::lonnet::escape($resource->symb()) . |
&escape($resource->symb()) . |
"&folderManip=1\">"; |
"&folderManip=1\">"; |
|
|
} else { |
} else { |
Line 1176 sub render_resource {
|
Line 1178 sub render_resource {
|
!$params->{'condensed'}) { |
!$params->{'condensed'}) { |
my $displaypart=$resource->part_display($part); |
my $displaypart=$resource->part_display($part); |
$partLabel = " (".&mt('Part: [_1]', $displaypart).")"; |
$partLabel = " (".&mt('Part: [_1]', $displaypart).")"; |
if ($link!~/\#/) { $link.='#'.&Apache::lonnet::escape($part); } |
if ($link!~/\#/) { $link.='#'.&escape($part); } |
$title = ""; |
$title = ""; |
} |
} |
|
|
Line 1220 sub render_communication_status {
|
Line 1222 sub render_communication_status {
|
foreach (split(/\,/, $feedback)) { |
foreach (split(/\,/, $feedback)) { |
if ($_) { |
if ($_) { |
$feedbackHTML .= ' <a '.$target.' href="/adm/email?display=' |
$feedbackHTML .= ' <a '.$target.' href="/adm/email?display=' |
. &Apache::lonnet::escape($_) . '">' |
. &escape($_) . '">' |
. '<img src="'.$location.'/feedback.gif" ' |
. '<img src="'.$location.'/feedback.gif" ' |
. 'border="0" /></a>'; |
. 'border="0" /></a>'; |
} |
} |
Line 1235 sub render_communication_status {
|
Line 1237 sub render_communication_status {
|
if ($_) { |
if ($_) { |
$errorcount++; |
$errorcount++; |
$errorHTML .= ' <a '.$target.' href="/adm/email?display=' |
$errorHTML .= ' <a '.$target.' href="/adm/email?display=' |
. &Apache::lonnet::escape($_) . '">' |
. &escape($_) . '">' |
. '<img src="'.$location.'/bomb.gif" ' |
. '<img src="'.$location.'/bomb.gif" ' |
. 'border="0" /></a>'; |
. 'border="0" /></a>'; |
} |
} |
Line 1608 sub render {
|
Line 1610 sub render {
|
my ($link,$text); |
my ($link,$text); |
if ($condition) { |
if ($condition) { |
$link='"navmaps?condition=0&filter=&'.$queryString. |
$link='"navmaps?condition=0&filter=&'.$queryString. |
'&here='.&Apache::lonnet::escape($here).'"'; |
'&here='.&escape($here).'"'; |
$text='Close all folders'; |
$text='Close all folders'; |
} else { |
} else { |
$link='"navmaps?condition=1&filter=&'.$queryString. |
$link='"navmaps?condition=1&filter=&'.$queryString. |
'&here='.&Apache::lonnet::escape($here).'"'; |
'&here='.&escape($here).'"'; |
$text='Open all folders'; |
$text='Open all folders'; |
} |
} |
if ($args->{'caller'} eq 'navmapsdisplay') { |
if ($args->{'caller'} eq 'navmapsdisplay') { |
Line 1923 END
|
Line 1925 END
|
my $srcHasQuestion = $src =~ /\?/; |
my $srcHasQuestion = $src =~ /\?/; |
$args->{"resourceLink"} = $src. |
$args->{"resourceLink"} = $src. |
($srcHasQuestion?'&':'?') . |
($srcHasQuestion?'&':'?') . |
'symb=' . &Apache::lonnet::escape($symb).$anchor; |
'symb=' . &escape($symb).$anchor; |
} |
} |
# Now, we've decided what parts to show. Loop through them and |
# Now, we've decided what parts to show. Loop through them and |
# show them. |
# show them. |
Line 2228 sub generate_email_discuss_status {
|
Line 2230 sub generate_email_discuss_status {
|
foreach my $msgid (@keys) { |
foreach my $msgid (@keys) { |
if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) { |
if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) { |
my $plain= |
my $plain= |
&Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid)); |
&LONCAPA::unescape(&LONCAPA::unescape($msgid)); |
if ($plain=~/ \[([^\]]+)\]\:/) { |
if ($plain=~/ \[([^\]]+)\]\:/) { |
my $url=$1; |
my $url=$1; |
if ($plain=~/\:Error \[/) { |
if ($plain=~/\:Error \[/) { |
Line 2574 sub parmval_real {
|
Line 2576 sub parmval_real {
|
my $result=''; |
my $result=''; |
|
|
my ($mapname,$id,$fn)=&Apache::lonnet::decode_symb($symb); |
my ($mapname,$id,$fn)=&Apache::lonnet::decode_symb($symb); |
|
$mapname = &Apache::lonnet::deversion($mapname); |
# ----------------------------------------------------- Cascading lookup scheme |
# ----------------------------------------------------- Cascading lookup scheme |
my $rwhat=$what; |
my $rwhat=$what; |
$what=~s/^parameter\_//; |
$what=~s/^parameter\_//; |
Line 3830 sub contains_problem {
|
Line 3832 sub contains_problem {
|
} |
} |
sub is_sequence { |
sub is_sequence { |
my $self=shift; |
my $self=shift; |
my $src = $self->src(); |
|
return $self->navHash("is_map_", 1) && |
return $self->navHash("is_map_", 1) && |
$self->navHash("map_type_" . $self->map_pc()) eq 'sequence'; |
$self->navHash("map_type_" . $self->map_pc()) eq 'sequence'; |
} |
} |
Line 3905 Returns a string with the type of the ma
|
Line 3906 Returns a string with the type of the ma
|
sub map_finish { |
sub map_finish { |
my $self = shift; |
my $self = shift; |
my $src = $self->src(); |
my $src = $self->src(); |
$src = Apache::lonnet::clutter($src); |
$src = &Apache::lonnet::clutter($src); |
my $res = $self->navHash("map_finish_$src", 0); |
my $res = $self->navHash("map_finish_$src", 0); |
$res = $self->{NAV_MAP}->getById($res); |
$res = $self->{NAV_MAP}->getById($res); |
return $res; |
return $res; |
Line 3918 sub map_pc {
|
Line 3919 sub map_pc {
|
sub map_start { |
sub map_start { |
my $self = shift; |
my $self = shift; |
my $src = $self->src(); |
my $src = $self->src(); |
$src = Apache::lonnet::clutter($src); |
$src = &Apache::lonnet::clutter($src); |
my $res = $self->navHash("map_start_$src", 0); |
my $res = $self->navHash("map_start_$src", 0); |
$res = $self->{NAV_MAP}->getById($res); |
$res = $self->{NAV_MAP}->getById($res); |
return $res; |
return $res; |
Line 4030 sub awarded {
|
Line 4031 sub awarded {
|
if (!defined($part)) { $part = '0'; } |
if (!defined($part)) { $part = '0'; } |
return $self->{NAV_MAP}->{STUDENT_DATA}->{$self->symb()}->{'resource.'.$part.'.awarded'}; |
return $self->{NAV_MAP}->{STUDENT_DATA}->{$self->symb()}->{'resource.'.$part.'.awarded'}; |
} |
} |
|
# this should work exactly like the copy in lonhomework.pm |
sub duedate { |
sub duedate { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
|
my $date; |
my $interval=$self->parmval("interval", $part); |
my $interval=$self->parmval("interval", $part); |
if ($interval) { |
my $due_date=$self->parmval("duedate", $part); |
|
if (defined($interval)) { |
my $first_access=&Apache::lonnet::get_first_access('map',$self->symb); |
my $first_access=&Apache::lonnet::get_first_access('map',$self->symb); |
if ($first_access) { return ($first_access+$interval); } |
if (defined($first_access)) { |
|
$interval = $first_access+$interval; |
|
$date = ($interval < $due_date)? $interval : $due_date; |
|
} else { |
|
$date = $due_date; |
|
} |
|
} else { |
|
$date = $due_date; |
} |
} |
return $self->parmval("duedate", $part); |
return $date; |
} |
} |
sub handgrade { |
sub handgrade { |
(my $self, my $part) = @_; |
(my $self, my $part) = @_; |
Line 4155 email data was not extracted when the na
|
Line 4166 email data was not extracted when the na
|
used like this: |
used like this: |
|
|
for (split(/\,/, $res->getFeedback())) { |
for (split(/\,/, $res->getFeedback())) { |
my $link = &Apache::lonnet::escape($_); |
my $link = &escape($_); |
... |
... |
|
|
and use the link as appropriate. |
and use the link as appropriate. |
Line 4385 sub extractParts {
|
Line 4396 sub extractParts {
|
# So we have to use our knowlege of part names to figure out |
# So we have to use our knowlege of part names to figure out |
# where the part names begin and end, and even then, it is possible |
# where the part names begin and end, and even then, it is possible |
# to construct ambiguous situations. |
# to construct ambiguous situations. |
foreach (split /,/, $metadata) { |
foreach my $data (split /,/, $metadata) { |
if ($_ =~ /^([a-zA-Z]+)response_(.*)/ |
if ($data =~ /^([a-zA-Z]+)response_(.*)/ |
|| $_ =~ /^(Task)_(.*)/) { |
|| $data =~ /^(Task)_(.*)/) { |
my $responseType = $1; |
my $responseType = $1; |
my $partStuff = $2; |
my $partStuff = $2; |
my $partIdSoFar = ''; |
my $partIdSoFar = ''; |
Line 4399 sub extractParts {
|
Line 4410 sub extractParts {
|
if ($parts{$partIdSoFar}) { |
if ($parts{$partIdSoFar}) { |
my @otherChunks = @partChunks[$i+1..$#partChunks]; |
my @otherChunks = @partChunks[$i+1..$#partChunks]; |
my $responseId = join('_', @otherChunks); |
my $responseId = join('_', @otherChunks); |
push @{$responseIdHash{$partIdSoFar}}, $responseId; |
if ($self->is_task()) { |
push @{$responseTypeHash{$partIdSoFar}}, $responseType; |
push(@{$responseIdHash{$partIdSoFar}}, |
|
$partIdSoFar); |
|
} else { |
|
push(@{$responseIdHash{$partIdSoFar}}, |
|
$responseId); |
|
} |
|
push(@{$responseTypeHash{$partIdSoFar}}, |
|
$responseType); |
} |
} |
} |
} |
} |
} |