version 1.273, 2004/07/27 23:35:34
|
version 1.280, 2004/08/27 20:34:13
|
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 navigation in separate window")."</a> "; |
.&mt("Launch navigation window")."</a> "; |
} |
} |
return $result; |
return $result; |
} |
} |
Line 119 window.status='Done.';
|
Line 119 window.status='Done.';
|
ENDCLOSE |
ENDCLOSE |
} |
} |
|
|
|
sub nav_control_js { |
|
my $nav=($ENV{'environment.remotenavmap'} eq 'on'); |
|
return (<<NAVCONTROL); |
|
var w_loncapanav_flag="$nav"; |
|
|
|
|
|
function gonav(url) { |
|
if (w_loncapanav_flag != 1) { |
|
go(url); |
|
} else { |
|
navwindow=window.open(url, |
|
"loncapanav","height=600,width=400,scrollbars=1"); |
|
} |
|
} |
|
NAVCONTROL |
|
} |
|
|
sub update { |
sub update { |
if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; } |
if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; } |
if (!$ENV{'request.course.id'}) { return ''; } |
if (!$ENV{'request.course.id'}) { return ''; } |
Line 164 sub real_handler {
|
Line 181 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 |
|
} else { |
|
my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); |
|
my $mainwindow='window.open('.$nothing.',"loncapaclient","",false);'; |
|
$menu=(<<MENU) |
|
swmenu=$mainwindow |
|
$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 230 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=''; |
my $more_unload; |
my $more_unload; |
|
my $body_only=''; |
if ($ENV{'environment.remotenavmap'} eq 'on') { |
if ($ENV{'environment.remotenavmap'} eq 'on') { |
$r->print('<script type="text/javascript"> |
$r->print('<script type="text/javascript"> |
function collapse() { |
function collapse() { |
Line 208 ENDSUBM
|
Line 244 ENDSUBM
|
</script>'); |
</script>'); |
# FIXME need to be smarter to only catch window close events |
# FIXME need to be smarter to only catch window close events |
# $more_unload="collapse()" |
# $more_unload="collapse()" |
|
$body_only=1; |
} |
} |
if ($ENV{'form.register'}) { |
if ($ENV{'form.register'}) { |
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
Line 221 ENDSUBM
|
Line 258 ENDSUBM
|
# Header |
# Header |
$r->print('</head>'. |
$r->print('</head>'. |
&Apache::loncommon::bodytag('Navigate Course Contents','', |
&Apache::loncommon::bodytag('Navigate Course Contents','', |
$addentries,'','',$ENV{'form.register'})); |
$addentries,$body_only,'', |
|
$ENV{'form.register'})); |
$r->print('<script>window.focus();</script>'. |
$r->print('<script>window.focus();</script>'. |
&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); |
&Apache::loncommon::help_open_menu('','Navigation Screen','Navigation_Screen','',undef,'RAT')); |
|
|
Line 275 ENDSUBM
|
Line 313 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 separate navigation window"). |
&mt("Close navigation window"). |
"</a> "); |
"</a> "); |
} |
} |
|
|
Line 324 ENDSUBM
|
Line 362 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 400 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 631 sub timeToHumanString {
|
Line 673 sub timeToHumanString {
|
} |
} |
|
|
# Not this year, so show the year |
# Not this year, so show the year |
my $timeStr = strftime("on %A, %b %e %G at %I:%M %P", localtime($time)); |
my $timeStr = strftime("on %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; |
return $timeStr; |
Line 1077 sub render_resource {
|
Line 1119 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 1412 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 1567 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 1645 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 1665 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 2263 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 2464 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 3730 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 |