version 1.123, 2003/01/10 17:46:46
|
version 1.129.2.1, 2003/02/01 19:55:00
|
Line 96 sub real_handler {
|
Line 96 sub real_handler {
|
'')); |
'')); |
$r->print('<script>window.focus();</script>'); |
$r->print('<script>window.focus();</script>'); |
|
|
|
$r->rflush(); |
|
|
|
# Now that we've displayed some stuff to the user, init the navmap |
|
$navmap->init(); |
|
|
$r->print('<table border="0" cellpadding="2" cellspacing="0">'); |
$r->print('<table border="0" cellpadding="2" cellspacing="0">'); |
my $date=localtime; |
my $date=localtime; |
$r->print('<tr><td align="right" valign="bottom">Key: </td>'); |
$r->print('<tr><td align="right" valign="bottom">Key: </td>'); |
Line 178 sub real_handler {
|
Line 183 sub real_handler {
|
$r->print('<br> '); |
$r->print('<br> '); |
$r->rflush(); |
$r->rflush(); |
|
|
# Now that we've displayed some stuff to the user, init the navmap |
|
$navmap->init(); |
|
|
|
# Check that it's defined |
# Check that it's defined |
if (!($navmap->courseMapDefined())) { |
if (!($navmap->courseMapDefined())) { |
$r->print('<font size="+2" color="red">Coursemap undefined.</font>' . |
$r->print('<font size="+2" color="red">Coursemap undefined.</font>' . |
Line 600 sub real_handler {
|
Line 602 sub real_handler {
|
$r->print("</td>\n"); |
$r->print("</td>\n"); |
|
|
# SECOND COL: Is there text, feedback, errors?? |
# SECOND COL: Is there text, feedback, errors?? |
my $discussionHTML = ""; my $feedbackHTML = ""; |
my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = ""; |
|
|
if ($curRes->hasDiscussion()) { |
if ($curRes->hasDiscussion()) { |
$discussionHTML = $linkopen . |
$discussionHTML = $linkopen . |
Line 620 sub real_handler {
|
Line 622 sub real_handler {
|
} |
} |
} |
} |
|
|
$r->print("<td width=\"75\" align=\"left\" valign=\"center\">$discussionHTML$feedbackHTML </td>"); |
if ($curRes->getErrors()) { |
|
my $errors = $curRes->getErrors(); |
|
foreach (split(/,/, $errors)) { |
|
if ($_) { |
|
$errorHTML .= ' <a href="/adm/email?display=' |
|
. &Apache::lonnet::escape($_) . '">' |
|
. '<img src="/adm/lonMisc/bomb.gif" ' |
|
. 'border="0" /></a>'; |
|
} |
|
} |
|
} |
|
|
|
$r->print("<td width=\"75\" align=\"left\" valign=\"center\">$discussionHTML$feedbackHTML$errorHTML </td>"); |
|
|
# Is this the first displayed part of a multi-part problem |
# Is this the first displayed part of a multi-part problem |
# that has not been condensed, so we should suppress these two |
# that has not been condensed, so we should suppress these two |
Line 672 sub real_handler {
|
Line 686 sub real_handler {
|
$r->print('<script>location += "#curloc";</script>'); |
$r->print('<script>location += "#curloc";</script>'); |
} |
} |
|
|
$r->print("</body></html>"); |
|
|
|
$navmap->untieHashes(); |
$navmap->untieHashes(); |
|
|
|
$r->print("</body></html>"); |
|
|
return OK; |
return OK; |
} |
} |
|
|
Line 985 sub new {
|
Line 999 sub new {
|
return undef; |
return undef; |
} |
} |
|
|
|
$self->{HASH_TIED} = 1; |
$self->{NAV_HASH} = \%navmaphash; |
$self->{NAV_HASH} = \%navmaphash; |
$self->{PARM_HASH} = \%parmhash; |
$self->{PARM_HASH} = \%parmhash; |
|
|
bless($self); |
bless($self); |
$self->untieHashes(); |
|
|
|
return $self; |
return $self; |
} |
} |
Line 1060 sub init {
|
Line 1074 sub init {
|
my %emailstatus = &Apache::lonnet::dump('email_status'); |
my %emailstatus = &Apache::lonnet::dump('email_status'); |
my $logoutTime = $emailstatus{'logout'}; |
my $logoutTime = $emailstatus{'logout'}; |
my $courseLeaveTime = $emailstatus{'logout_'.$ENV{'request.course.id'}}; |
my $courseLeaveTime = $emailstatus{'logout_'.$ENV{'request.course.id'}}; |
$self->{LAST_CHECK} = ($courseLeaveTime > $logoutTime ? |
$self->{LAST_CHECK} = ($courseLeaveTime < $logoutTime ? |
$courseLeaveTime : $logoutTime); |
$courseLeaveTime : $logoutTime); |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
$cdom, $cnum); |
$cdom, $cnum); |
Line 1141 sub DESTROY {
|
Line 1155 sub DESTROY {
|
$self->untieHashes(); |
$self->untieHashes(); |
} |
} |
|
|
# Private function: Does the given resource (as a symb string) have |
# Private method: Does the given resource (as a symb string) have |
# current discussion? Returns 0 if chat/mail data not extracted. |
# current discussion? Returns 0 if chat/mail data not extracted. |
sub hasDiscussion { |
sub hasDiscussion { |
my $self = shift; |
my $self = shift; |
my $symb = shift; |
my $symb = shift; |
if (!defined($self->{DISCUSSION_TIME})) { return 0; } |
if (!defined($self->{DISCUSSION_TIME})) { return 0; } |
|
|
|
#return defined($self->{DISCUSSION_TIME}->{$symb}); |
return $self->{DISCUSSION_TIME}->{$symb} > |
return $self->{DISCUSSION_TIME}->{$symb} > |
$self->{LAST_CHECK}; |
$self->{LAST_CHECK}; |
} |
} |
|
|
# Private function: Does the given resource (as a symb string) have |
# Private method: Does the given resource (as a symb string) have |
# current feedback? Returns the string in the feedback hash, which |
# current feedback? Returns the string in the feedback hash, which |
# will be false if it does not exist. |
# will be false if it does not exist. |
sub getFeedback { |
sub getFeedback { |
Line 1164 sub getFeedback {
|
Line 1179 sub getFeedback {
|
return $self->{FEEDBACK}->{$symb}; |
return $self->{FEEDBACK}->{$symb}; |
} |
} |
|
|
|
# Private method: Get the errors for that resource (by source). |
|
sub getErrors { |
|
my $self = shift; |
|
my $src = shift; |
|
|
|
if (!defined($self->{ERROR_MSG})) { return ""; } |
|
return $self->{ERROR_MSG}->{$src}; |
|
} |
|
|
=pod |
=pod |
|
|
=item * B<getById>(id): Based on the ID of the resource (1.1, 3.2, etc.), get a resource object for that resource. This method, or other methods that use it (as in the resource object) is the only proper way to obtain a resource object. |
=item * B<getById>(id): Based on the ID of the resource (1.1, 3.2, etc.), get a resource object for that resource. This method, or other methods that use it (as in the resource object) is the only proper way to obtain a resource object. |
Line 1655 sub next {
|
Line 1679 sub next {
|
# If this is a blank resource, don't actually return it. |
# If this is a blank resource, don't actually return it. |
# Should you ever find you need it, make sure to add an option to the code |
# Should you ever find you need it, make sure to add an option to the code |
# that you can use; other things depend on this behavior. |
# that you can use; other things depend on this behavior. |
if (!$self->{HERE}->src()) { |
if (!$self->{HERE}->src() || !$self->{HERE}->browsePriv()) { |
return $self->next(); |
return $self->next(); |
} |
} |
|
|
Line 2229 sub hasDiscussion {
|
Line 2253 sub hasDiscussion {
|
|
|
sub getFeedback { |
sub getFeedback { |
my $self = shift; |
my $self = shift; |
return $self->{NAV_MAP}->getFeedback($self->src()); |
my $source = $self->src(); |
|
if ($source =~ /^\/res\//) { $source = substr $source, 5; } |
|
return $self->{NAV_MAP}->getFeedback($source); |
|
} |
|
|
|
sub getErrors { |
|
my $self = shift; |
|
my $source = $self->src(); |
|
if ($source =~ /^\/res\//) { $source = substr $source, 5; } |
|
return $self->{NAV_MAP}->getErrors($source); |
} |
} |
|
|
=pod |
=pod |
Line 2585 sub getNext {
|
Line 2618 sub getNext {
|
my $next = $choice->goesto(); |
my $next = $choice->goesto(); |
$next = $self->{NAV_MAP}->getById($next); |
$next = $self->{NAV_MAP}->getById($next); |
|
|
# Don't remember it if the student doesn't have browse priviledges |
push @branches, $next; |
# future note: this may properly belong in the client of the resource |
|
my $browsePriv = $self->{BROWSE_PRIV}; |
|
if (!defined($browsePriv)) { |
|
$browsePriv = &Apache::lonnet::allowed('bre', $self->src); |
|
$self->{BROWSE_PRIV} = $browsePriv; |
|
} |
|
if (!($browsePriv ne '2' && $browsePriv ne 'F')) { |
|
push @branches, $next; |
|
} |
|
} |
} |
return \@branches; |
return \@branches; |
} |
} |
Line 2608 sub getPrevious {
|
Line 2632 sub getPrevious {
|
my $prev = $choice->comesfrom(); |
my $prev = $choice->comesfrom(); |
$prev = $self->{NAV_MAP}->getById($prev); |
$prev = $self->{NAV_MAP}->getById($prev); |
|
|
# Don't remember it if the student doesn't have browse priviledges |
push @branches, $prev; |
# future note: this may properly belong in the client of the resource |
|
my $browsePriv = $self->{BROWSE_PRIV}; |
|
if (!defined($browsePriv)) { |
|
$browsePriv = &Apache::lonnet::allowed('bre', $self->src); |
|
$self->{BROWSE_PRIV} = $browsePriv; |
|
} |
|
if (!($browsePriv ne '2' && $browsePriv ne 'F')) { |
|
push @branches, $prev; |
|
} |
|
} |
} |
return \@branches; |
return \@branches; |
} |
} |
|
|
|
sub browsePriv { |
|
my $self = shift; |
|
if (defined($self->{BROWSE_PRIV})) { |
|
return $self->{BROWSE_PRIV}; |
|
} |
|
|
|
$self->{BROWSE_PRIV} = &Apache::lonnet::allowed('bre', $self->src()); |
|
} |
|
|
=pod |
=pod |
|
|
=back |
=back |