version 1.349.2.6, 2006/02/10 22:35:24
|
version 1.379, 2006/04/29 17:57:29
|
Line 194 MENU
|
Line 194 MENU
|
MENU |
MENU |
} |
} |
$r->send_http_header; |
$r->send_http_header; |
my $html=&Apache::lonxml::xmlbegin(); |
my $js =<<"ENDSUBM"; |
$r->print(<<"ENDSUBM"); |
|
$html |
|
<head> |
|
<script type="text/javascript"> |
<script type="text/javascript"> |
function submitthis() { |
function submitthis() { |
$menu |
$menu |
Line 205 MENU
|
Line 202 MENU
|
} |
} |
|
|
</script> |
</script> |
</head> |
|
<body bgcolor="#FFFFFF" onLoad="submitthis()"></body> |
|
</html> |
|
ENDSUBM |
ENDSUBM |
|
$r->print(&Apache::loncommon::start_page(undef,$js, |
|
{'only_body' => 1, |
|
'bgcolor' => '#FFFFFF', |
|
'add_entries' => |
|
{'onload' => |
|
"submitthis()"}}). |
|
&Apache::loncommon::end_page()); |
|
|
return OK; |
return OK; |
} |
} |
if ($ENV{QUERY_STRING} =~ /^launchExternal/) { |
if ($ENV{QUERY_STRING} =~ /^launchExternal/) { |
Line 239 MENU
|
Line 241 MENU
|
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
$r->send_http_header; |
$r->send_http_header; |
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print("$html<head>\n"); |
|
$r->print("<title>".&mt('Navigate Course Contents')."</title>"); |
|
# ------------------------------------------------------------ Get query string |
# ------------------------------------------------------------ Get query string |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework','postsymb']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework','postsymb']); |
|
|
# ----------------------------------------------------- Force menu registration |
# ----------------------------------------------------- Force menu registration |
my $addentries=''; |
|
my $more_unload; |
|
my $body_only=''; |
my $body_only=''; |
|
my $js; |
if ($env{'environment.remotenavmap'} eq 'on') { |
if ($env{'environment.remotenavmap'} eq 'on') { |
$r->print('<script type="text/javascript"> |
$js='<script type="text/javascript"> |
function collapse() { |
function collapse() { |
this.document.location="/adm/navmaps?collapseExternal"; |
this.document.location="/adm/navmaps?collapseExternal"; |
} |
} |
</script>'); |
</script>'; |
# FIXME need to be smarter to only catch window close events |
|
# $more_unload="collapse()" |
|
$body_only=1; |
$body_only=1; |
} |
} |
if ($env{'form.register'}) { |
|
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
|
'" onUnload="'.&Apache::lonmenu::unloadevents().';'. |
|
$more_unload.'"'; |
|
$r->print(&Apache::lonmenu::registerurl(1)); |
|
} else { |
|
$addentries=' onUnload="'.$more_unload.'"'; |
|
} |
|
|
|
# Header |
# Header |
$r->print('</head>'. |
$r->print(&Apache::loncommon::start_page('Navigate Course Contents',$js, |
&Apache::loncommon::bodytag('Navigate Course Contents','', |
{'only_body' => $body_only, |
$addentries,$body_only,'', |
'force_register' => |
$env{'form.register'})); |
$env{'form.register'},})); |
$r->print('<script>window.focus();</script>'); |
$r->print('<script type="text/javascript">window.focus();</script>'); |
|
|
$r->rflush(); |
$r->rflush(); |
|
|
# Check that it's defined |
# Check that it's defined |
if (!($navmap->courseMapDefined())) { |
if (!($navmap->courseMapDefined())) { |
$r->print(&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); |
$r->print(&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); |
$r->print('<font size="+2" color="red">Coursemap undefined.</font>' . |
$r->print('<font size="+2" color="red">'.&mt('Coursemap undefined.'). |
'</body></html>'); |
'</font>' . |
|
&Apache::loncommon::end_page()); |
return OK; |
return OK; |
} |
} |
|
|
Line 328 MENU
|
Line 318 MENU
|
"Close navigation window"); |
"Close navigation window"); |
} |
} |
|
|
my $jumpToFirstHomework = 0; |
|
# Check to see if the student is jumping to next open, do-able problem |
# Check to see if the student is jumping to next open, do-able problem |
if ($ENV{QUERY_STRING} =~ /^jumpToFirstHomework/) { |
if ($ENV{QUERY_STRING} =~ /^jumpToFirstHomework/) { |
$jumpToFirstHomework = 1; |
|
# Find the next homework problem that they can do. |
# Find the next homework problem that they can do. |
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $iterator = $navmap->getIterator(undef, undef, undef, 1); |
my $curRes; |
my $curRes; |
my $foundDoableProblem = 0; |
my $foundDoableProblem = 0; |
my $problemRes; |
my $minimumduedate; |
|
|
while (($curRes = $iterator->next()) && !$foundDoableProblem) { |
while ($curRes = $iterator->next()) { |
if (ref($curRes) && $curRes->is_problem()) { |
if (ref($curRes) && $curRes->is_problem()) { |
my $status = $curRes->status(); |
my $status = $curRes->status(); |
if ($curRes->completable()) { |
if ($curRes->completable()) { |
$problemRes = $curRes; |
my $thisduedate=$curRes->duedate(); |
|
unless ($foundDoableProblem) { |
|
$minimumduedate=$thisduedate; |
|
} |
|
|
$foundDoableProblem = 1; |
$foundDoableProblem = 1; |
|
|
# Pop open all previous maps |
if ($thisduedate<=$minimumduedate) { |
my $stack = $iterator->getStack(); |
# Pop open all previous maps |
pop @$stack; # last resource in the stack is the problem |
my $stack = $iterator->getStack(); |
# itself, which we don't need in the map stack |
pop @$stack; # last resource in the stack is the problem |
my @mapPcs = map {$_->map_pc()} @$stack; |
# itself, which we don't need in the map stack |
$env{'form.filter'} = join(',', @mapPcs); |
my @mapPcs = map {$_->map_pc()} @$stack; |
|
$env{'form.filter'} = join(',', @mapPcs); |
# Mark as both "here" and "jump" |
|
$env{'form.postsymb'} = $curRes->symb(); |
# Mark as both "here" and "jump" |
|
$env{'form.postsymb'} = $curRes->symb(); |
|
$minimumduedate=$thisduedate; |
|
} |
} |
} |
} |
} |
} |
} |
Line 365 MENU
|
Line 361 MENU
|
} else { |
} else { |
&add_linkitem(\%toplinkitems,'firsthomework', |
&add_linkitem(\%toplinkitems,'firsthomework', |
'location.href="navmaps?jumpToFirstHomework"', |
'location.href="navmaps?jumpToFirstHomework"', |
"Show Me My First Homework Problem"); |
"Show my first due problem"); |
} |
} |
|
|
my $suppressEmptySequences = 0; |
my $suppressEmptySequences = 0; |
Line 382 MENU
|
Line 378 MENU
|
}; |
}; |
&add_linkitem(\%toplinkitems,'everything', |
&add_linkitem(\%toplinkitems,'everything', |
'location.href="navmaps?sort='.$env{'form.sort'}.'"', |
'location.href="navmaps?sort='.$env{'form.sort'}.'"', |
"Show Everything"); |
"Show everything"); |
$r->print("<p><font size='+2'>".&mt("Uncompleted Homework")."</font></p>"); |
$r->print("<p><font size='+2'>".&mt("Uncompleted Problems")."</font></p>"); |
$env{'form.filter'} = ''; |
$env{'form.filter'} = ''; |
$env{'form.condition'} = 1; |
$env{'form.condition'} = 1; |
$resource_no_folder_link = 1; |
$resource_no_folder_link = 1; |
Line 391 MENU
|
Line 387 MENU
|
&add_linkitem(\%toplinkitems,'uncompleted', |
&add_linkitem(\%toplinkitems,'uncompleted', |
'location.href="navmaps?sort='.$env{'form.sort'}. |
'location.href="navmaps?sort='.$env{'form.sort'}. |
'&showOnlyHomework=1"', |
'&showOnlyHomework=1"', |
"Show Only Uncompleted Homework"); |
"Show only uncompleted problems"); |
} |
} |
|
|
my %selected=($env{'form.sort'} => 'selected=on'); |
my %selected=($env{'form.sort'} => 'selected=on'); |
Line 434 MENU
|
Line 430 MENU
|
#my $td=&tv_interval($t0); |
#my $td=&tv_interval($t0); |
#$r->print("<br />$td"); |
#$r->print("<br />$td"); |
|
|
$r->print("</body></html>"); |
$r->print(&Apache::loncommon::end_page()); |
$r->rflush(); |
$r->rflush(); |
|
|
return OK; |
return OK; |
Line 683 sub timeToHumanString {
|
Line 679 sub timeToHumanString {
|
|
|
if($format ne '') { |
if($format ne '') { |
my $timeStr = strftime($format, localtime($time)); |
my $timeStr = strftime($format, localtime($time)); |
return $timeStr.&Apache::lonlocal::gettimezone(); |
return $timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
|
|
# Less then 5 days away, display day of the week and |
# Less then 5 days away, display day of the week and |
Line 694 sub timeToHumanString {
|
Line 690 sub timeToHumanString {
|
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 pm/noon/; |
$timeStr =~ s/12:00 pm/noon/; |
return ($inPast ? "last " : "this ") . |
return ($inPast ? "last " : "this ") . |
$timeStr.&Apache::lonlocal::gettimezone(); |
$timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
|
|
my $conjunction='on'; |
my $conjunction='on'; |
Line 709 sub timeToHumanString {
|
Line 705 sub timeToHumanString {
|
my $timeStr = strftime("$conjunction %A, %b %e at %I:%M %P", localtime($time)); |
my $timeStr = strftime("$conjunction %A, %b %e at %I:%M %P", localtime($time)); |
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 pm/noon/; |
$timeStr =~ s/12:00 pm/noon/; |
return $timeStr.&Apache::lonlocal::gettimezone(); |
return $timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
|
|
# Not this year, so show the year |
# Not this year, so show the year |
my $timeStr = strftime("$conjunction %A, %b %e %Y at %I:%M %P", localtime($time)); |
my $timeStr = strftime("$conjunction %A, %b %e %Y at %I:%M %P", localtime($time)); |
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 am/00:00/; |
$timeStr =~ s/12:00 pm/noon/; |
$timeStr =~ s/12:00 pm/noon/; |
return $timeStr.&Apache::lonlocal::gettimezone(); |
return $timeStr.&Apache::lonlocal::gettimezone($time); |
} |
} |
} |
} |
|
|
Line 1095 sub render_resource {
|
Line 1091 sub render_resource {
|
|
|
if ($resource->is_problem()) { |
if ($resource->is_problem()) { |
if ($part eq '0' || $params->{'condensed'}) { |
if ($part eq '0' || $params->{'condensed'}) { |
$icon ='<img src="'.$location.'/problem.gif" alt=" " border="0" />'; |
$icon ='<img src="'.$location.'/problem.gif" alt="'.&mt('Problem').'" border="0" />'; |
} else { |
} else { |
$icon = $params->{'indentString'}; |
$icon = $params->{'indentString'}; |
} |
} |
Line 1112 sub render_resource {
|
Line 1108 sub render_resource {
|
} |
} |
|
|
my $folderType = $resource->is_sequence() ? 'folder' : 'page'; |
my $folderType = $resource->is_sequence() ? 'folder' : 'page'; |
|
my $title=$resource->title; |
|
$title=~s/\"/\"/g; |
if (!$params->{'resource_no_folder_link'}) { |
if (!$params->{'resource_no_folder_link'}) { |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif'; |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . '.gif'; |
$icon = "<img src='$location/$icon' alt='". |
$icon = "<img src='$location/$icon' alt=\"". |
($nowOpen ? 'Open Folder' : 'Close Folder')."' border='0' />"; |
($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" border='0' />"; |
|
|
$linkopen = "<a href=\"" . $params->{'url'} . '?' . |
$linkopen = "<a href=\"" . $params->{'url'} . '?' . |
$params->{'queryString'} . '&filter='; |
$params->{'queryString'} . '&filter='; |
Line 1134 sub render_resource {
|
Line 1131 sub render_resource {
|
# Don't allow users to manipulate folder |
# Don't allow users to manipulate folder |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . |
$icon = "navmap.$folderType." . ($nowOpen ? 'closed' : 'open') . |
'.nomanip.gif'; |
'.nomanip.gif'; |
$icon = "<img src='$location/$icon' alt='". |
$icon = "<img src='$location/$icon' alt=\"". |
($nowOpen ? 'Open Folder' : 'Close Folder')."' border='0' />"; |
($nowOpen ? &mt('Open Folder') : &mt('Close Folder')).' '.$title."\" border='0' />"; |
|
|
$linkopen = ""; |
$linkopen = ""; |
$linkclose = ""; |
$linkclose = ""; |
Line 1143 sub render_resource {
|
Line 1140 sub render_resource {
|
} |
} |
|
|
if ($resource->randomout()) { |
if ($resource->randomout()) { |
$nonLinkedText .= ' <i>(hidden)</i> '; |
$nonLinkedText .= ' <i>('.&mt('hidden').')</i> '; |
} |
} |
if (!$resource->condval()) { |
if (!$resource->condval()) { |
$nonLinkedText .= ' <i>(conditionally hidden)</i> '; |
$nonLinkedText .= ' <i>('.&mt('conditionally hidden').')</i> '; |
} |
} |
|
|
# We're done preparing and finally ready to start the rendering |
# We're done preparing and finally ready to start the rendering |
Line 1178 sub render_resource {
|
Line 1175 sub render_resource {
|
if ($resource->is_problem() && $part ne '0' && |
if ($resource->is_problem() && $part ne '0' && |
!$params->{'condensed'}) { |
!$params->{'condensed'}) { |
my $displaypart=$resource->part_display($part); |
my $displaypart=$resource->part_display($part); |
$partLabel = " (Part: $displaypart)"; |
$partLabel = " (".&mt('Part: [_1]', $displaypart).")"; |
if ($link!~/\#/) { $link.='#'.&Apache::lonnet::escape($part); } |
if ($link!~/\#/) { $link.='#'.&Apache::lonnet::escape($part); } |
$title = ""; |
$title = ""; |
} |
} |
|
|
if ($params->{'condensed'} && $resource->countParts() > 1) { |
if ($params->{'condensed'} && $resource->countParts() > 1) { |
$nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; |
$nonLinkedText .= ' ('.&mt('[_1] parts', $resource->countParts()).')'; |
} |
} |
|
|
my $target; |
my $target; |
Line 1472 sub render {
|
Line 1469 sub render {
|
$navmap = Apache::lonnavmaps::navmap->new(); |
$navmap = Apache::lonnavmaps::navmap->new(); |
if (!defined($navmap)) { |
if (!defined($navmap)) { |
# no londer in course |
# no londer in course |
return '<font color="red">No course selected</font><br /> |
return '<font color="red">'.&mt('No course selected').'</font><br /> |
<a href="/adm/roles">Select a course</a><br />'; |
<a href="/adm/roles">'.&mt('Select a course').'</a><br />'; |
} |
} |
} |
} |
|
|
Line 1612 sub render {
|
Line 1609 sub render {
|
if ($condition) { |
if ($condition) { |
$link='"navmaps?condition=0&filter=&'.$queryString. |
$link='"navmaps?condition=0&filter=&'.$queryString. |
'&here='.&Apache::lonnet::escape($here).'"'; |
'&here='.&Apache::lonnet::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='.&Apache::lonnet::escape($here).'"'; |
$text='Open All Folders'; |
$text='Open all folders'; |
} |
} |
if ($args->{'caller'} eq 'navmapsdisplay') { |
if ($args->{'caller'} eq 'navmapsdisplay') { |
&add_linkitem($args->{'linkitems'},'changefolder', |
&add_linkitem($args->{'linkitems'},'changefolder', |
Line 2066 In order of increasing complexity and po
|
Line 2063 In order of increasing complexity and po
|
|
|
=over 4 |
=over 4 |
|
|
=item * C<$navmap-E<gt>getByX>, where X is B<Id>, B<Symb>, B<Url> or B<MapPc>. This provides |
=item * C<$navmap-E<gt>getByX>, where X is B<Id>, B<Symb> or B<MapPc> and getResourceByUrl. This provides |
various ways to obtain resource objects, based on various identifiers. |
various ways to obtain resource objects, based on various identifiers. |
Use this when you want to request information about one object or |
Use this when you want to request information about one object or |
a handful of resources you already know the identities of, from some |
a handful of resources you already know the identities of, from some |
other source. For more about Ids, Symbs, and MapPcs, see the |
other source. For more about Ids, Symbs, and MapPcs, see the |
Resource documentation. Note that Url should be a B<last resort>, |
Resource documentation. Note that Url should be a B<last resort>, |
not your first choice; it only works when there is only one |
not your first choice; it only really works when there is only one |
instance of the resource in the course, which only applies to |
instance of the resource in the course, which only applies to |
maps, and even that may change in the future. |
maps, and even that may change in the future (see the B<getResourceByUrl> |
|
documentation for more details.) |
|
|
=item * C<my @resources = $navmap-E<gt>retrieveResources(args)>. This |
=item * C<my @resources = $navmap-E<gt>retrieveResources(args)>. This |
retrieves resources matching some criterion and returns them |
retrieves resources matching some criterion and returns them |
Line 2269 sub get_user_data {
|
Line 2267 sub get_user_data {
|
sub get_discussion_data { |
sub get_discussion_data { |
my $self = shift; |
my $self = shift; |
if ($self->{RETRIEVED_DISCUSSION_DATA}) { |
if ($self->{RETRIEVED_DISCUSSION_DATA}) { |
return $self->{DISCUSSION_DATA}; |
return $self->{DISCUSSION_DATA}; |
} |
} |
|
|
|
$self->generate_email_discuss_status(); |
|
|
my $cid=$env{'request.course.id'}; |
my $cid=$env{'request.course.id'}; |
my $cdom=$env{'course.'.$cid.'.domain'}; |
my $cdom=$env{'course.'.$cid.'.domain'}; |
my $cnum=$env{'course.'.$cid.'.num'}; |
my $cnum=$env{'course.'.$cid.'.num'}; |
|
|
# Retrieve discussion data for resources in course |
# Retrieve discussion data for resources in course |
my %discussion_data = &Apache::lonnet::dump($cid,$cdom,$cnum); |
my %discussion_data = &Apache::lonnet::dumpstore($cid,$cdom,$cnum); |
|
|
|
|
$self->{DISCUSSION_DATA} = \%discussion_data; |
$self->{DISCUSSION_DATA} = \%discussion_data; |
$self->{RETRIEVED_DISCUSSION_DATA} = 1; |
$self->{RETRIEVED_DISCUSSION_DATA} = 1; |
return $self->{DISCUSSION_DATA}; |
return $self->{DISCUSSION_DATA}; |
Line 2340 sub hasDiscussion {
|
Line 2340 sub hasDiscussion {
|
} |
} |
} |
} |
|
|
|
sub last_post_time { |
|
my $self = shift; |
|
my $symb = shift; |
|
my $ressymb = $self->wrap_symb($symb); |
|
return $self->{DISCUSSION_TIME}->{$ressymb}; |
|
} |
|
|
|
sub unread_discussion { |
|
my $self = shift; |
|
my $symb = shift; |
|
|
|
$self->get_discussion_data(); |
|
|
|
my $ressymb = $self->wrap_symb($symb); |
|
# keys used to store bulletinboard postings use 'unwrapped' symb. |
|
my $discsymb = $self->unwrap_symb($ressymb); |
|
my $version = $self->{DISCUSSION_DATA}{'version:'.$discsymb}; |
|
if (!$version) { return; } |
|
|
|
my $prevread = $self->{LAST_READ}{$ressymb}; |
|
|
|
my $unreadcount = 0; |
|
my $hiddenflag = 0; |
|
my $deletedflag = 0; |
|
my ($hidden,$deleted); |
|
|
|
my %subjects; |
|
|
|
for (my $id=$version; $id>0; $id--) { |
|
my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$discsymb}; |
|
my @keys=split(/:/,$vkeys); |
|
if (grep(/^hidden$/ ,@keys)) { |
|
if (!$hiddenflag) { |
|
$hidden = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':hidden'}; |
|
$hiddenflag = 1; |
|
} |
|
} elsif (grep(/^deleted$/,@keys)) { |
|
if (!$deletedflag) { |
|
$deleted = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':deleted'}; |
|
$deletedflag = 1; |
|
} |
|
} else { |
|
if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./) |
|
&& $prevread < $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}) { |
|
$unreadcount++; |
|
$subjects{$unreadcount}= |
|
$id.': '.$self->{DISCUSSION_DATA}{$id.':'.$discsymb.':subject'}; |
|
} |
|
} |
|
} |
|
if (wantarray) { |
|
return ($unreadcount,\%subjects); |
|
} |
|
return $unreadcount |
|
} |
|
|
sub wrap_symb { |
sub wrap_symb { |
my $self = shift; |
my $self = shift; |
my $symb = shift; |
my $symb = shift; |
if ($symb =~ m-___(adm/\w+/\w+/)(\d+)(/bulletinboard)$-) { |
if ($symb =~ m-___(adm/[^/]+/[^/]+/)(\d+)(/bulletinboard)$-) { |
unless ($symb =~ m|adm/wrapper/adm|) { |
unless ($symb =~ m|adm/wrapper/adm|) { |
$symb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3; |
$symb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3; |
} |
} |
Line 2351 sub wrap_symb {
|
Line 2407 sub wrap_symb {
|
return $symb; |
return $symb; |
} |
} |
|
|
|
sub unwrap_symb { |
|
my $self = shift; |
|
my $ressymb = shift; |
|
my $discsymb = $ressymb; |
|
if ($ressymb =~ m-^(bulletin___\d+___)adm/wrapper/(adm/[^/]+/[^/]+/\d+/bulletinboard)$-) { |
|
$discsymb = $1.$2; |
|
} |
|
return $discsymb; |
|
} |
|
|
# Private method: 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. |
Line 2495 sub parmval_real {
|
Line 2561 sub parmval_real {
|
|
|
my $cid=$env{'request.course.id'}; |
my $cid=$env{'request.course.id'}; |
my $csec=$env{'request.course.sec'}; |
my $csec=$env{'request.course.sec'}; |
|
my $cgroup=''; |
|
my @cgrps=split(/:/,$env{'request.course.groups'}); |
|
if (@cgrps > 0) { |
|
@cgrps = sort(@cgrps); |
|
$cgroup = $cgrps[0]; |
|
} |
my $uname=$env{'user.name'}; |
my $uname=$env{'user.name'}; |
my $udom=$env{'user.domain'}; |
my $udom=$env{'user.domain'}; |
|
|
Line 2512 sub parmval_real {
|
Line 2584 sub parmval_real {
|
my $mapparm=$mapname.'___(all).'.$what; |
my $mapparm=$mapname.'___(all).'.$what; |
my $usercourseprefix=$cid; |
my $usercourseprefix=$cid; |
|
|
|
my $grplevel=$usercourseprefix.'.['.$cgroup.'].'.$what; |
|
my $grplevelr=$usercourseprefix.'.['.$cgroup.'].'.$symbparm; |
|
my $grplevelm=$usercourseprefix.'.['.$cgroup.'].'.$mapparm; |
|
|
my $seclevel= $usercourseprefix.'.['.$csec.'].'.$what; |
my $seclevel= $usercourseprefix.'.['.$csec.'].'.$what; |
my $seclevelr=$usercourseprefix.'.['.$csec.'].'.$symbparm; |
my $seclevelr=$usercourseprefix.'.['.$csec.'].'.$symbparm; |
my $seclevelm=$usercourseprefix.'.['.$csec.'].'.$mapparm; |
my $seclevelm=$usercourseprefix.'.['.$csec.'].'.$mapparm; |
Line 2532 sub parmval_real {
|
Line 2608 sub parmval_real {
|
} |
} |
|
|
# ------------------------------------------------------- second, check course |
# ------------------------------------------------------- second, check course |
|
if ($cgroup ne '' and defined($courseopt)) { |
|
if (defined($$courseopt{$grplevelr})) { return $$courseopt{$grplevelr}; } |
|
if (defined($$courseopt{$grplevelm})) { return $$courseopt{$grplevelm}; } |
|
if (defined($$courseopt{$grplevel})) { return $$courseopt{$grplevel}; } |
|
} |
|
|
if ($csec and defined($courseopt)) { |
if ($csec and defined($courseopt)) { |
if (defined($$courseopt{$seclevelr})) { return $$courseopt{$seclevelr}; } |
if (defined($$courseopt{$seclevelr})) { return $$courseopt{$seclevelr}; } |
if (defined($$courseopt{$seclevelm})) { return $$courseopt{$seclevelm}; } |
if (defined($$courseopt{$seclevelm})) { return $$courseopt{$seclevelm}; } |
Line 2738 sub usedVersion {
|
Line 2820 sub usedVersion {
|
1; |
1; |
|
|
package Apache::lonnavmaps::iterator; |
package Apache::lonnavmaps::iterator; |
use WeakRef; |
use Scalar::Util qw(weaken); |
use Apache::lonnet; |
use Apache::lonnet; |
|
|
=pod |
=pod |
Line 3219 sub populateStack {
|
Line 3301 sub populateStack {
|
1; |
1; |
|
|
package Apache::lonnavmaps::DFSiterator; |
package Apache::lonnavmaps::DFSiterator; |
use WeakRef; |
use Scalar::Util qw(weaken); |
use Apache::lonnet; |
use Apache::lonnet; |
|
|
# Not documented in the perldoc: This is a simple iterator that just walks |
# Not documented in the perldoc: This is a simple iterator that just walks |
Line 3403 sub populateStack {
|
Line 3485 sub populateStack {
|
1; |
1; |
|
|
package Apache::lonnavmaps::resource; |
package Apache::lonnavmaps::resource; |
use WeakRef; |
use Scalar::Util qw(weaken); |
use Apache::lonnet; |
use Apache::lonnet; |
|
|
=pod |
=pod |
Line 3582 sub kind { my $self=shift; return $self-
|
Line 3664 sub kind { my $self=shift; return $self-
|
sub randomout { my $self=shift; return $self->navHash("randomout_", 1); } |
sub randomout { my $self=shift; return $self->navHash("randomout_", 1); } |
sub randompick { |
sub randompick { |
my $self = shift; |
my $self = shift; |
return $self->{NAV_MAP}->{PARM_HASH}->{$self->symb . |
return $self->parmval('randompick'); |
'.0.parameter_randompick'}; |
|
} |
} |
sub link { |
sub link { |
my $self=shift; |
my $self=shift; |
Line 3701 sub retrieveResources {
|
Line 3782 sub retrieveResources {
|
return $self->{NAV_MAP}->retrieveResources(@_); |
return $self->{NAV_MAP}->retrieveResources(@_); |
} |
} |
|
|
|
sub is_exam { |
|
my ($self,$part) = @_; |
|
if ($self->parmval('type',$part) eq 'exam') { |
|
return 1; |
|
} |
|
if ($self->src() =~ /\.(exam)$/) { |
|
return 1; |
|
} |
|
return 0; |
|
} |
sub is_html { |
sub is_html { |
my $self=shift; |
my $self=shift; |
my $src = $self->src(); |
my $src = $self->src(); |
Line 3713 sub is_page {
|
Line 3804 sub is_page {
|
return $self->navHash("is_map_", 1) && |
return $self->navHash("is_map_", 1) && |
$self->navHash("map_type_" . $self->map_pc()) eq 'page'; |
$self->navHash("map_type_" . $self->map_pc()) eq 'page'; |
} |
} |
|
sub is_practice { |
|
my $self=shift; |
|
my ($part) = @_; |
|
if ($self->parmval('type',$part) eq 'practice') { |
|
return 1; |
|
} |
|
return 0; |
|
} |
sub is_problem { |
sub is_problem { |
my $self=shift; |
my $self=shift; |
my $src = $self->src(); |
my $src = $self->src(); |
return ($src =~ /\.(problem|exam|quiz|assess|survey|form|library|task)$/) |
if ($src =~ /\.(problem|exam|quiz|assess|survey|form|library|task)$/) { |
|
return !($self->is_practice()); |
|
} |
|
return 0; |
} |
} |
sub contains_problem { |
sub contains_problem { |
my $self=shift; |
my $self=shift; |
Line 3743 sub is_survey {
|
Line 3845 sub is_survey {
|
} |
} |
return 0; |
return 0; |
} |
} |
|
sub is_task { |
|
my $self=shift; |
|
my $src = $self->src(); |
|
return ($src =~ /\.(task)$/) |
|
} |
|
|
sub is_empty_sequence { |
sub is_empty_sequence { |
my $self=shift; |
my $self=shift; |
Line 4027 Returns a false value if there has been
|
Line 4134 Returns a false value if there has been
|
logged in, true if there has. Always returns false if the discussion |
logged in, true if there has. Always returns false if the discussion |
data was not extracted when the nav map was constructed. |
data was not extracted when the nav map was constructed. |
|
|
|
=item * B<last_post_time>: |
|
|
|
Returns a false value if there hasn't been discussion otherwise returns |
|
unix timestamp of last time a discussion posting (or edit) was made. |
|
|
|
=item * B<unread_discussion>: |
|
|
|
returns in scalar context the count of the number of unread discussion |
|
postings |
|
|
|
returns in list context both the count of postings and a hash ref |
|
containing the subjects of all unread postings |
|
|
=item * B<getFeedback>: |
=item * B<getFeedback>: |
|
|
Gets the feedback for the resource and returns the raw feedback string |
Gets the feedback for the resource and returns the raw feedback string |
Line 4047 sub hasDiscussion {
|
Line 4167 sub hasDiscussion {
|
return $self->{NAV_MAP}->hasDiscussion($self->symb()); |
return $self->{NAV_MAP}->hasDiscussion($self->symb()); |
} |
} |
|
|
|
sub last_post_time { |
|
my $self = shift; |
|
return $self->{NAV_MAP}->last_post_time($self->symb()); |
|
} |
|
|
|
sub unread_discussion { |
|
my $self = shift; |
|
return $self->{NAV_MAP}->unread_discussion($self->symb()); |
|
} |
|
|
sub getFeedback { |
sub getFeedback { |
my $self = shift; |
my $self = shift; |
my $source = $self->src(); |
my $source = $self->src(); |
Line 4144 sub countResponses {
|
Line 4274 sub countResponses {
|
sub responseTypes { |
sub responseTypes { |
my $self = shift; |
my $self = shift; |
my %responses; |
my %responses; |
foreach my $part ($self->parts()) { |
foreach my $part (@{$self->parts()}) { |
foreach my $responsetype ($self->responseType($part)) { |
foreach my $responsetype ($self->responseType($part)) { |
$responses{$responsetype}++ if (defined($responsetype)); |
$responses{$responsetype}++ if (defined($responsetype)); |
} |
} |
Line 4255 sub extractParts {
|
Line 4385 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_(.*)/ |
|
|| $data =~ /^(Task)_(.*)/) { |
my $responseType = $1; |
my $responseType = $1; |
my $partStuff = $2; |
my $partStuff = $2; |
my $partIdSoFar = ''; |
my $partIdSoFar = ''; |
Line 4268 sub extractParts {
|
Line 4399 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); |
} |
} |
} |
} |
} |
} |