version 1.271, 2004/07/26 22:19:59
|
version 1.277, 2004/08/20 20:14:27
|
Line 100 sub launch_win {
|
Line 100 sub launch_win {
|
} |
} |
if ($mode eq 'link') { |
if ($mode eq 'link') { |
$result.='<a href="javascript:launch_navmapwin();void(0);">' |
$result.='<a href="javascript:launch_navmapwin();void(0);">' |
.&mt("Launch Navmaps in seperate window")."</a> "; |
.&mt("Launch navigation window")."</a> "; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 164 sub real_handler {
|
Line 164 sub real_handler {
|
if ($ENV{QUERY_STRING} eq 'collapseExternal') { |
if ($ENV{QUERY_STRING} eq 'collapseExternal') { |
&Apache::lonnet::put('environment',{'remotenavmap' => 'off'}); |
&Apache::lonnet::put('environment',{'remotenavmap' => 'off'}); |
&Apache::lonnet::appenv('environment.remotenavmap' => 'off'); |
&Apache::lonnet::appenv('environment.remotenavmap' => 'off'); |
|
my $menu=&Apache::lonmenu::reopenmenu(); |
|
my $navstatus=&Apache::lonmenu::get_nav_status(); |
|
if ($menu) { |
|
$menu=(<<MENU) |
|
swmenu=$menu |
|
swmenu.clearTimeout(swmenu.menucltim); |
|
$navstatus |
|
MENU |
|
} |
$r->print(<<"ENDSUBM"); |
$r->print(<<"ENDSUBM"); |
<html> |
<html> |
<head> |
<head> |
<script type="text/javascript"> |
<script type="text/javascript"> |
function submitthis() { |
function submitthis() { |
|
$menu |
self.close(); |
self.close(); |
} |
} |
|
|
</script> |
</script> |
</head> |
</head> |
<body bgcolor="#FFFFFF" onLoad="submitthis()"></body> |
<body bgcolor="#FFFFFF" onLoad="submitthis()"></body> |
Line 195 ENDSUBM
|
Line 206 ENDSUBM
|
$r->print("<html><head>\n"); |
$r->print("<html><head>\n"); |
$r->print("<title>".&mt('Navigate Course Contents')."</title>"); |
$r->print("<title>".&mt('Navigate Course Contents')."</title>"); |
# ------------------------------------------------------------ Get query string |
# ------------------------------------------------------------ Get query string |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort','showOnlyHomework']); |
|
|
# ----------------------------------------------------- Force menu registration |
# ----------------------------------------------------- Force menu registration |
my $addentries=''; |
my $addentries=''; |
Line 275 ENDSUBM
|
Line 286 ENDSUBM
|
if ($ENV{'environment.remotenavmap'} eq 'on') { |
if ($ENV{'environment.remotenavmap'} eq 'on') { |
# $r->print("<a href='navmaps?collapseExternal'>" . |
# $r->print("<a href='navmaps?collapseExternal'>" . |
$r->print("<a href='javascript:collapse();void(0);'>" . |
$r->print("<a href='javascript:collapse();void(0);'>" . |
&mt("Close external navmaps"). |
&mt("Close navigation window"). |
"</a> "); |
"</a> "); |
} |
} |
|
|
Line 324 ENDSUBM
|
Line 335 ENDSUBM
|
|
|
# Display only due homework. |
# Display only due homework. |
my $showOnlyHomework = 0; |
my $showOnlyHomework = 0; |
if ($ENV{QUERY_STRING} eq 'showOnlyHomework') { |
if ($ENV{'form.showOnlyHomework'} eq "1") { |
$showOnlyHomework = 1; |
$showOnlyHomework = 1; |
$suppressEmptySequences = 1; |
$suppressEmptySequences = 1; |
$filterFunc = sub { my $res = shift; |
$filterFunc = sub { my $res = shift; |
return $res->completable() || $res->is_map(); |
return $res->completable() || $res->is_map(); |
}; |
}; |
|
$r->print("<a href='navmaps?sort=$ENV{'form.sort'}'>" . |
|
&mt("Show Everything")."</a> "); |
$r->print("<p><font size='+2'>".&mt("Uncompleted Homework")."</font></p>"); |
$r->print("<p><font size='+2'>".&mt("Uncompleted Homework")."</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; |
} else { |
} else { |
$r->print("<a href='navmaps?showOnlyHomework'>" . |
$r->print("<a href='navmaps?sort=$ENV{'form.sort'}&showOnlyHomework=1'>" . |
&mt("Show Only Uncompleted Homework")."</a> "); |
&mt("Show Only Uncompleted Homework")."</a> "); |
} |
} |
|
|
$r->print("<form> |
my %selected=($ENV{'form.sort'} => 'selected=on'); |
|
my $sort_html=("<form> |
<nobr> |
<nobr> |
Sort by: |
<input type=\"hidden\" name=\"showOnlyHomework\" value=\"".$ENV{'form.showOnlyHomework'}."\" /> |
|
<input type=\"submit\" value=\"".&mt('Sort by:')."\" /> |
<select name=\"sort\"> |
<select name=\"sort\"> |
<option value=\"\"></option> |
<option value=\"default\" $selected{'default'}>".&mt('Default')."</option> |
<option value=\"title\">Title</option> |
<option value=\"title\" $selected{'title'} >".&mt('Title')."</option> |
<option value=\"duedate\">Duedate</option> |
<option value=\"duedate\" $selected{'duedate'}>".&mt('Duedate')."</option> |
</select> |
</select> |
<input type=\"submit\" name=\"Sort\" /> |
|
</nobr> |
</nobr> |
</form>"); |
</form>"); |
# renderer call |
# renderer call |
Line 359 ENDSUBM
|
Line 373 ENDSUBM
|
'suppressEmptySequences' => $suppressEmptySequences, |
'suppressEmptySequences' => $suppressEmptySequences, |
'filterFunc' => $filterFunc, |
'filterFunc' => $filterFunc, |
'resource_no_folder_link' => $resource_no_folder_link, |
'resource_no_folder_link' => $resource_no_folder_link, |
|
'sort_html'=> $sort_html, |
'r' => $r}; |
'r' => $r}; |
my $render = render($renderArgs); |
my $render = render($renderArgs); |
$navmap->untieHashes(); |
$navmap->untieHashes(); |
Line 1077 sub render_resource {
|
Line 1092 sub render_resource {
|
|
|
if ($resource->is_problem() && $part ne '0' && |
if ($resource->is_problem() && $part ne '0' && |
!$params->{'condensed'}) { |
!$params->{'condensed'}) { |
my $displaypart=&Apache::lonnet::EXT('resource.'.$part.'.display', |
my $displaypart=$resource->part_display($part); |
$resource->symb()); |
|
unless ($displaypart) { $displaypart=$part; } |
|
$partLabel = " (Part: $displaypart)"; |
$partLabel = " (Part: $displaypart)"; |
$link.='#'.&Apache::lonnet::escape($part); |
$link.='#'.&Apache::lonnet::escape($part); |
$title = ""; |
$title = ""; |
Line 1372 sub render {
|
Line 1385 sub render {
|
#$currenturl=~s/^[^\/]+//; |
#$currenturl=~s/^[^\/]+//; |
|
|
$here = $jump = &Apache::lonnet::symbread($currenturl); |
$here = $jump = &Apache::lonnet::symbread($currenturl); |
} else { |
} |
&Apache::lonnet::logthis("Hrrm,"); |
|
|
|
} |
|
|
|
# Step three: Ensure the folders are open |
# Step three: Ensure the folders are open |
my $mapIterator = $navmap->getIterator(undef, undef, undef, 1); |
my $mapIterator = $navmap->getIterator(undef, undef, undef, 1); |
Line 1530 END
|
Line 1540 END
|
$result .= '<br />'; |
$result .= '<br />'; |
} |
} |
} |
} |
|
|
|
if ($args->{'sort_html'}) { $result.=$args->{'sort_html'}; } |
|
|
$result .= "<br />\n"; |
$result .= "<br />\n"; |
if ($r) { |
if ($r) { |
$r->print($result); |
$r->print($result); |
Line 1605 END
|
Line 1618 END
|
my @resources; |
my @resources; |
my $code='';# sub { !(shift->is_map();) }; |
my $code='';# sub { !(shift->is_map();) }; |
if ($args->{'sort'} eq 'title') { |
if ($args->{'sort'} eq 'title') { |
@resources=$navmap->retrieveResources(undef, |
my $oldFilterFunc = $filterFunc; |
sub { !shift->is_map(); }); |
my $filterFunc= |
|
sub { |
|
my ($res)=@_; |
|
if ($res->is_map()) { return 0;} |
|
return &$oldFilterFunc($res); |
|
}; |
|
@resources=$navmap->retrieveResources(undef,$filterFunc); |
@resources= sort {lc($a->compTitle) cmp lc($b->compTitle)} @resources; |
@resources= sort {lc($a->compTitle) cmp lc($b->compTitle)} @resources; |
} elsif ($args->{'sort'} eq 'duedate') { |
} elsif ($args->{'sort'} eq 'duedate') { |
@resources=$navmap->retrieveResources(undef, |
@resources=$navmap->retrieveResources(undef, |
Line 1619 END
|
Line 1638 END
|
lc($a->compTitle) cmp lc($b->compTitle) |
lc($a->compTitle) cmp lc($b->compTitle) |
} |
} |
} @resources; |
} @resources; |
|
} else { |
|
#unknow sort mechanism or default |
|
undef($args->{'sort'}); |
} |
} |
|
|
|
|
while (1) { |
while (1) { |
if ($args->{'sort'}) { |
if ($args->{'sort'}) { |
$curRes = shift(@resources); |
$curRes = shift(@resources); |
Line 2213 sub getById {
|
Line 2236 sub getById {
|
sub getBySymb { |
sub getBySymb { |
my $self = shift; |
my $self = shift; |
my $symb = shift; |
my $symb = shift; |
|
|
my ($mapUrl, $id, $filename) = &Apache::lonnet::decode_symb($symb); |
my ($mapUrl, $id, $filename) = &Apache::lonnet::decode_symb($symb); |
my $map = $self->getResourceByUrl($mapUrl); |
my $map = $self->getResourceByUrl($mapUrl); |
return $self->getById($map->map_pc() . '.' . $id); |
my $returnvalue = undef; |
|
if (ref($map)) { |
|
$returnvalue = $self->getById($map->map_pc() .'.'.$id); |
|
} |
|
return $returnvalue; |
} |
} |
|
|
sub getByMapPc { |
sub getByMapPc { |
Line 2409 in the filter function.
|
Line 2437 in the filter function.
|
|
|
=cut |
=cut |
|
|
|
|
sub getResourceByUrl { |
sub getResourceByUrl { |
my $self = shift; |
my $self = shift; |
my $resUrl = shift; |
my $resUrl = shift; |
Line 3674 sub weight {
|
Line 3703 sub weight {
|
$self->symb(), $ENV{'user.domain'}, |
$self->symb(), $ENV{'user.domain'}, |
$ENV{'user.name'}, |
$ENV{'user.name'}, |
$ENV{'request.course.sec'}); |
$ENV{'request.course.sec'}); |
|
} |
|
sub part_display { |
|
my $self= shift(); my $partID = shift(); |
|
if (! defined($partID)) { $partID = '0'; } |
|
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display', |
|
$self->symb); |
|
if (! defined($display) || $display eq '') { |
|
$display = $partID; |
|
} |
|
return $display; |
} |
} |
|
|
# Multiple things need this |
# Multiple things need this |
Line 4288 sub status {
|
Line 4326 sub status {
|
|
|
if ($dateStatus == PAST_DUE_ANSWER_LATER || |
if ($dateStatus == PAST_DUE_ANSWER_LATER || |
$dateStatus == PAST_DUE_NO_ANSWER ) { |
$dateStatus == PAST_DUE_NO_ANSWER ) { |
return $suppressFeedback ? ANSWER_SUBMITTED ? $dateStatus; |
return $suppressFeedback ? ANSWER_SUBMITTED : $dateStatus; |
} |
} |
|
|
if ($dateStatus == ANSWER_OPEN) { |
if ($dateStatus == ANSWER_OPEN) { |