--- loncom/interface/lonnavmaps.pm 2011/10/10 17:36:56 1.444.2.7 +++ loncom/interface/lonnavmaps.pm 2010/03/29 17:55:55 1.447 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Navigate Maps Handler # -# $Id: lonnavmaps.pm,v 1.444.2.7 2011/10/10 17:36:56 raeburn Exp $ +# $Id: lonnavmaps.pm,v 1.447 2010/03/29 17:55:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees @@ -509,7 +509,7 @@ my %statusIconMap = my %iconAltTags = #texthash does not work here ( 'navmap.correct.gif' => 'Correct', 'navmap.wrong.gif' => 'Incorrect', - 'navmap.open.gif' => 'Is Open', + 'navmap.open.gif' => 'Open', 'navmap.partial.gif' => 'Partially Correct', 'navmap.ellipsis.gif' => 'Attempted', ); @@ -527,7 +527,6 @@ my %colormap = $resObj->INCORRECT => '', $resObj->OPEN => '', $resObj->NOTHING_SET => '', - $resObj->CREDIT_ATTEMPTED => '', $resObj->ATTEMPTED => '', $resObj->ANSWER_SUBMITTED => '', $resObj->PARTIALLY_CORRECT => '#006600' @@ -539,35 +538,6 @@ my $hurryUpColor = "#FF0000"; my $future_slots_checked = 0; my $future_slots = 0; -sub close { - if ($env{'environment.remotenavmap'} ne 'on') { return ''; } - return(< -window.status='Accessing Nav Control'; -menu=window.open("/adm/rat/empty.html","loncapanav", - "height=600,width=400,scrollbars=1"); -window.status='Closing Nav Control'; -menu.close(); -window.status='Done.'; - -ENDCLOSE -} - -sub update { - if ($env{'environment.remotenavmap'} ne 'on') { return ''; } - if (!$env{'request.course.id'}) { return ''; } - if ($ENV{'REQUEST_URI'}=~m|^/adm/navmaps|) { return ''; } - return(< - -ENDUPDATE -} - - sub addToFilter { my $hashIn = shift; my $addition = shift; @@ -641,7 +611,7 @@ sub getDescription { return &mt("Not currently assigned."); } if ($status == $res->OPEN_LATER) { - return &mt("Open [_1]",&timeToHumanString($open,'start')); + return &mt("Open ") .timeToHumanString($open,'start'); } if ($res->simpleStatus($part) == $res->OPEN) { unless (&Apache::lonnet::allowed('mgr',$env{'request.course.id'})) { @@ -675,22 +645,22 @@ sub getDescription { if ($status == $res->OPEN) { if ($due) { if ($res->is_practice()) { - return &mt("Closes [_1]",&timeToHumanString($due,'start')); + return &mt("Closes ")." " .timeToHumanString($due,'start'); } else { - return &mt("Due [_1]",&timeToHumanString($due,'end')); + return &mt("Due")." " .timeToHumanString($due,'end'); } } else { return &mt("Open, no due date"); } } if ($status == $res->PAST_DUE_ANSWER_LATER) { - return &mt("Answer open [_1]",&timeToHumanString($answer,'start')); + return &mt("Answer open")." " .timeToHumanString($answer,'start'); } if ($status == $res->PAST_DUE_NO_ANSWER) { if ($res->is_practice()) { - return &mt("Closed [_1]",&timeToHumanString($due,'start')); + return &mt("Closed")." " . timeToHumanString($due,'start'); } else { - return &mt("Was due [_1]",&timeToHumanString($due,'end')); + return &mt("Was due")." " . timeToHumanString($due,'end'); } } if (($status == $res->ANSWER_OPEN || $status == $res->PARTIALLY_CORRECT) @@ -707,11 +677,6 @@ sub getDescription { return &mt("Answer submitted, not yet graded"); } } - if ($status == $res->CREDIT_ATTEMPTED) { - if ($res->is_anonsurvey($part) || $res->is_survey($part)) { - return &mt("Credit for survey submission"); - } - } if ($status == $res->TRIES_LEFT) { my $tries = $res->tries($part); my $maxtries = $res->maxtries($part); @@ -723,7 +688,7 @@ sub getDescription { } } if ($due) { - return &mt("Due [_1]",&timeToHumanString($due,'end')) . + return &mt("Due")." " . timeToHumanString($due,'end') . " $triesString"; } else { return &mt("No due date")." $triesString"; @@ -808,31 +773,14 @@ sub timeToHumanString { # Less than an hour if ( $delta < $hour ) { - # If so, use minutes; or minutes, seconds (if format requires) + # If so, use minutes my $minutes = floor($delta / 60); - if (($format ne '') && ($format =~ /\%(T|S)/)) { - my $display; - if ($minutes == 1) { - $display = "${prefix}1 minute"; - } else { - $display = "$prefix$minutes minutes"; - } - my $seconds = $delta % $minute; - if ($seconds == 0) { - $display .= $tense; - } elsif ($seconds == 1) { - $display .= ", 1 second$tense"; - } else { - $display .= ", $seconds seconds$tense"; - } - return $display; - } if ($minutes == 1) { return "${prefix}1 minute$tense"; } return "$prefix$minutes minutes$tense"; } # Is it less than 24 hours away? If so, - # display hours + minutes, (and + seconds, if format specified it) + # display hours + minutes if ( $delta < $hour * 24) { my $hours = floor($delta / $hour); my $minutes = floor(($delta % $hour) / $minute); @@ -847,30 +795,15 @@ sub timeToHumanString { if ($minutes == 0) { $minuteString = ""; } - if (($format ne '') && ($format =~ /\%(T|S)/)) { - my $display = "$prefix$hourString$minuteString"; - my $seconds = $delta-(($hours * $hour)+($minutes * $minute)); - if ($seconds == 0) { - $display .= $tense; - } elsif ($seconds == 1) { - $display .= ", 1 second$tense"; - } else { - $display .= ", $seconds seconds$tense"; - } - return $display; - } return "$prefix$hourString$minuteString$tense"; } - # Date/time is more than 24 hours away - my $dt = DateTime->from_epoch(epoch => $time) ->set_time_zone(&Apache::lonlocal::gettimezone()); - # If there's a caller supplied format, use it, unless it only displays - # H:M:S or H:M. + # If there's a caller supplied format, use it. - if (($format ne '') && ($format ne '%T') && ($format ne '%R')) { + if ($format ne '') { my $timeStr = $dt->strftime($format); return $timeStr.' ('.$dt->time_zone_short_name().')'; } @@ -1006,10 +939,10 @@ sub render_resource { } if ($resource->randomout()) { - $nonLinkedText .= ' ('.&mt('hidden').') '; + $nonLinkedText .= ' ('.&mt('hidden').') '; } if (!$resource->condval()) { - $nonLinkedText .= ' ('.&mt('conditionally hidden').') '; + $nonLinkedText .= ' ('.&mt('conditionally hidden').') '; } if (($resource->is_practice()) && ($resource->is_raw_problem())) { $nonLinkedText .=' '.&mt('not graded').''; @@ -1053,12 +986,8 @@ sub render_resource { $nonLinkedText .= ' ('.&mt('[_1] parts', $resource->countParts()).')'; } - my $target; - if ($env{'environment.remotenavmap'} eq 'on') { - $target=' target="loncapaclient" '; - } if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { - $result .= "$curMarkerBegin$title$partLabel$curMarkerEnd$nonLinkedText"; + $result .= "$curMarkerBegin$title$partLabel$curMarkerEnd$nonLinkedText"; } else { $result .= "$curMarkerBegin$linkopen$title$partLabel$curMarkerEnd$nonLinkedText"; } @@ -1071,11 +1000,7 @@ sub render_communication_status { my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = ""; my $link = $params->{"resourceLink"}; - my $target; - if ($env{'environment.remotenavmap'} eq 'on') { - $target=' target="loncapaclient" '; - } - my $linkopen = ""; + my $linkopen = ""; my $linkclose = ""; my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc"); if ($resource->hasDiscussion()) { @@ -1088,7 +1013,7 @@ sub render_communication_status { my $feedback = $resource->getFeedback(); foreach my $msgid (split(/\,/, $feedback)) { if ($msgid) { - $feedbackHTML .= ' ' . ''.&mt('New E-mail').''; } @@ -1102,7 +1027,7 @@ sub render_communication_status { last if ($errorcount>=10); # Only output 10 bombs maximum if ($msgid) { $errorcount++; - $errorHTML .= ' ' . ''.&mt('New Error').''; } @@ -1122,11 +1047,7 @@ sub render_quick_status { $params->{'multipart'} && $part eq "0"; my $link = $params->{"resourceLink"}; - my $target; - if ($env{'environment.remotenavmap'} eq 'on') { - $target=' target="loncapaclient" '; - } - my $linkopen = ""; + my $linkopen = ""; my $linkclose = ""; $result .= ''; @@ -1164,7 +1085,7 @@ sub render_long_status { } if ($resource->kind() eq "res" && - $resource->is_raw_problem() && + ($resource->is_problem() || $resource->is_practice()) && !$firstDisplayed) { if ($color) {$result .= ""; } $result .= getDescription($resource, $part); @@ -1480,11 +1401,11 @@ sub render { my ($link,$text); if ($condition) { $link='navmaps?condition=0&filter=&'.$queryString. - '&here='.&escape($here); + '&here='.&escape($here); $text='Close all folders'; } else { $link='navmaps?condition=1&filter=&'.$queryString. - '&here='.&escape($here); + '&here='.&escape($here); $text='Open all folders'; } if ($env{'form.register'}) { @@ -1492,9 +1413,9 @@ sub render { } if ($args->{'caller'} eq 'navmapsdisplay') { &add_linkitem($args->{'linkitems'},'changefolder', - "location.href='$link'",$text); + "location.href='$link'",$text); } else { - $result.= ''.&mt($text).''; + $result.= ''.&mt($text).''; } $result .= "\n"; } @@ -1536,19 +1457,13 @@ END if ($args->{'caller'} eq 'navmapsdisplay') { $result .= ''. - ''. - &show_linkitems_toolbar($args->{'linkitems'}); + &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').''; + $result .= ''; + $result.=''; + $result.=&show_linkitems_toolbar($args->{'linkitems'}); if ($args->{'sort_html'}) { - if ($env{'environment.remotenavmap'} ne 'on') { - $result .= ''. - ''; - } else { - $result .= ''; - } - } else { - $result .= ''; + $result.=''. + ''; } $result .= '
'. - &Apache::loncommon::help_open_menu('Navigation Screen','Navigation_Screen',undef,'RAT').' '.&mt('Tools:').' '.&mt('Tools:').'   '.$args->{'sort_html'}.'

'. - $args->{'sort_html'}.'
   '.$args->{'sort_html'}.'
'; } elsif ($args->{'sort_html'}) { @@ -1800,7 +1715,7 @@ END if (defined($anchor)) { $anchor='#'.$anchor; } my $srcHasQuestion = $src =~ /\?/; $args->{"resourceLink"} = $src. - ($srcHasQuestion?'&':'?') . + ($srcHasQuestion?'&':'?') . 'symb=' . &escape($symb).$anchor; } # Now, we've decided what parts to show. Loop through them and @@ -1862,11 +1777,12 @@ END # it's quite likely this might fix other browsers, too, and # certainly won't hurt anything. if ($displayedJumpMarker) { - $result .= &Apache::lonhtmlcommon::scripttag(" + $result .= " +"; } $result.=&Apache::loncommon::end_data_table(); @@ -1888,9 +1804,9 @@ sub add_linkitem { sub show_linkitems_toolbar { my ($linkitems,$condition)=@_; - my @linkorder = ("launchnav","closenav","firsthomework", - "everything","uncompleted","changefolder","clearbubbles"); - my $result .=''."\n". + my @linkorder = ('firsthomework','everything','uncompleted', + 'changefolder','clearbubbles'); + my $result .=''."\n". ''."\n". '
    '; foreach my $link (@linkorder) { @@ -2388,7 +2304,7 @@ resource object. Based on the symb of the resource, get a resource object for that resource. This is one of the proper ways to get a resource object. -=item * B(map_pc): +=item * B(map_pc): Based on the map_pc of the resource, get a resource object for the given map. This is one of the proper ways to get a resource object. @@ -3924,12 +3840,6 @@ resource of the map. Returns a string with the type of the map in it. -=item *B: - -Returns a string with a comma-separated ordered list of map_pc IDs -for the hierarchy of maps containing a map, with the top level -map first, then descending to deeper levels, with the enclosing map last. - =back =cut @@ -3960,12 +3870,6 @@ sub map_type { my $pc = $self->map_pc(); return $self->navHash("map_type_$pc", 0); } -sub map_hierarchy { - my $self = shift; - my $pc = $self->map_pc(); - return $self->navHash("map_hierarchy_$pc", 0); -} - ##### # Property queries @@ -4721,10 +4625,6 @@ Information not available due to network Attempted, and not yet graded. -=item * B: - -Attempted, and credit received for attempt (survey and anonymous survey only). - =back =cut @@ -4736,7 +4636,6 @@ sub CORRECT { return 13; } sub CORRECT_BY_OVERRIDE { return 14; } sub EXCUSED { return 15; } sub ATTEMPTED { return 16; } -sub CREDIT_ATTEMPTED { return 17; } sub getCompletionStatus { my $self = shift; @@ -4755,13 +4654,6 @@ sub getCompletionStatus { if ($status eq 'incorrect_by_override') {return $self->INCORRECT_BY_OVERRIDE; } if ($status eq 'excused') {return $self->EXCUSED; } if ($status eq 'ungraded_attempted') {return $self->ATTEMPTED; } - if ($status eq 'credit_attempted') { - if ($self->is_anonsurvey($part) || $self->is_survey($part)) { - return $self->CREDIT_ATTEMPTED; - } else { - return $self->ATTEMPTED; - } - } return $self->NOT_ATTEMPTED; } @@ -4851,10 +4743,6 @@ The item is open and not yet tried. The problem has been attempted. -=item * B: - -The problem has been attempted, and credit given for the attempt (survey and anonymous survey only). - =item * B: An answer has been submitted, but the student should not see it. @@ -4928,10 +4816,6 @@ sub status { return ATTEMPTED; } - if ($completionStatus == CREDIT_ATTEMPTED) { - return CREDIT_ATTEMPTED; - } - # If it's EXCUSED, then return that no matter what if ($completionStatus == EXCUSED) { return EXCUSED; @@ -5034,7 +4918,7 @@ sub check_for_slot { my $taskstatus = $self->taskstatus(); $is_correct = (($taskstatus eq 'pass') || ($self->solved() =~ /^correct_/)); - $got_grade = ($taskstatus =~ /^(?:pass|fail)$/); + $got_grade = ($self->solved() =~ /^(?:pass|fail)$/); } else { $got_grade = 1; $is_correct = ($self->solved() =~ /^correct_/); @@ -5124,7 +5008,6 @@ my %compositeToSimple = INCORRECT() => INCORRECT, OPEN() => OPEN, ATTEMPTED() => ATTEMPTED, - CREDIT_ATTEMPTED() => CORRECT, ANSWER_SUBMITTED() => ATTEMPTED ); @@ -5198,9 +5081,8 @@ sub completable { # "If any of the parts are open, or have tries left (implies open), # and it is not "attempted" (manually graded problem), it is # not "complete" - if ($self->getCompletionStatus($part) == ATTEMPTED() || - $self->getCompletionStatus($part) == CREDIT_ATTEMPTED() || - $status == ANSWER_SUBMITTED() ) { + if ($self->getCompletionStatus($part) == ATTEMPTED() || + $status == ANSWER_SUBMITTED() ) { # did this part already, as well as we can next; }