version 1.1, 2006/10/10 20:16:26
|
version 1.13, 2009/09/08 20:56:47
|
Line 37 use Apache::lonnavmaps();
|
Line 37 use Apache::lonnavmaps();
|
use Apache::lonhtmlcommon(); |
use Apache::lonhtmlcommon(); |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::lonlocal; |
use Apache::lonlocal; |
|
use Time::HiRes qw( gettimeofday tv_interval ); |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
Line 70 sub real_handler {
|
Line 71 sub real_handler {
|
"Select Action"); |
"Select Action"); |
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 $menu=&Apache::lonmenu::reopenmenu(); |
my $navstatus=&Apache::lonmenu::get_nav_status(); |
my $navstatus=&Apache::lonmenu::get_nav_status(); |
if ($menu) { |
if ($menu) { |
Line 109 ENDSUBM
|
Line 110 ENDSUBM
|
} |
} |
if ($ENV{QUERY_STRING} =~ /^launchExternal/) { |
if ($ENV{QUERY_STRING} =~ /^launchExternal/) { |
&Apache::lonnet::put('environment',{'remotenavmap' => 'on'}); |
&Apache::lonnet::put('environment',{'remotenavmap' => 'on'}); |
&Apache::lonnet::appenv('environment.remotenavmap' => 'on'); |
&Apache::lonnet::appenv({'environment.remotenavmap' => 'on'}); |
my $menu=&Apache::lonmenu::reopenmenu(); |
my $menu=&Apache::lonmenu::reopenmenu(); |
my $navstatus=&Apache::lonmenu::get_nav_status(); |
my $navstatus=&Apache::lonmenu::get_nav_status(); |
if ($menu) { |
if ($menu) { |
Line 132 MENU
|
Line 133 MENU
|
if (!defined($navmap)) { |
if (!defined($navmap)) { |
my $requrl = $r->uri; |
my $requrl = $r->uri; |
$env{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized"; |
$env{'user.error.msg'} = "$requrl:bre:0:0:Course not initialized"; |
|
$env{'user.reinit'} = 1; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
$r->send_http_header; |
$r->send_http_header; |
Line 153 MENU
|
Line 155 MENU
|
|
|
# Header |
# Header |
my $course_type = &Apache::loncommon::course_type(); |
my $course_type = &Apache::loncommon::course_type(); |
$r->print(&Apache::loncommon::start_page('Navigate '.$course_type. |
my ($title,$breadcrumb_text); |
' Contents', |
if ($course_type eq 'Community') { |
$js, |
$title = 'Community Contents'; |
{'only_body' => $body_only, |
$breadcrumb_text = &mt('Community Contents'); |
'force_register' => |
} else { |
$env{'form.register'},})); |
$title = 'Course Contents'; |
|
$breadcrumb_text = &mt('Course Contents'); |
|
} |
|
$r->print(&Apache::loncommon::start_page($title, |
|
$js, |
|
{'only_body' => $body_only, |
|
'force_register' => $env{'form.register'}, |
|
'bread_crumbs' => [{text => $breadcrumb_text }],})); |
$r->print('<script type="text/javascript">window.focus();</script>'); |
$r->print('<script type="text/javascript">window.focus();</script>'); |
|
|
$r->rflush(); |
$r->rflush(); |
Line 224 MENU
|
Line 233 MENU
|
my $curRes; |
my $curRes; |
my $foundDoableProblem = 0; |
my $foundDoableProblem = 0; |
my $minimumduedate; |
my $minimumduedate; |
|
my $now = time(); |
|
|
while ($curRes = $iterator->next()) { |
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()) { |
my $thisduedate=$curRes->duedate(); |
my $thisduedate=$curRes->duedate(); |
if ($thisduedate > $now |
unless ($foundDoableProblem) { |
&& $curRes->completable()) { |
$minimumduedate=$thisduedate; |
|
} |
|
|
|
$foundDoableProblem = 1; |
$foundDoableProblem = 1; |
|
|
if ($thisduedate<=$minimumduedate) { |
if (!defined($minimumduedate) |
|
|| $thisduedate<$minimumduedate) { |
# Pop open all previous maps |
# Pop open all previous maps |
my $stack = $iterator->getStack(); |
my $stack = $iterator->getStack(); |
pop @$stack; # last resource in the stack is the problem |
pop @$stack; # last resource in the stack is the problem |
Line 254 MENU
|
Line 263 MENU
|
|
|
# If we found no problems, print a note to that effect. |
# If we found no problems, print a note to that effect. |
if (!$foundDoableProblem) { |
if (!$foundDoableProblem) { |
$r->print("<font size='+2'>All homework assignments have been completed.</font><br /><br />"); |
$r->print("<span class=\"LC_info\">" |
|
.&mt("All homework assignments have been completed.") |
|
."</span>"); |
} |
} |
} else { |
} else { |
&Apache::lonnavmaps::add_linkitem(\%toplinkitems,'firsthomework', |
&Apache::lonnavmaps::add_linkitem(\%toplinkitems,'firsthomework', |
Line 277 MENU
|
Line 288 MENU
|
&Apache::lonnavmaps::add_linkitem(\%toplinkitems,'everything', |
&Apache::lonnavmaps::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 Problems")."</font></p>"); |
$r->print("<span class=\"LC_info\">".&mt("Uncompleted Problems")."</span>"); |
$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 288 MENU
|
Line 299 MENU
|
"Show only uncompleted problems"); |
"Show only uncompleted problems"); |
} |
} |
|
|
my %selected=($env{'form.sort'} => 'selected=on'); |
my %selected=($env{'form.sort'} => ' selected="selected"'); |
my $sort_html=("<form> |
my $sort_html=("<form name=\"sortForm\"> |
<nobr> |
<span class=\"LC_nobreak\"> |
<input type=\"hidden\" name=\"showOnlyHomework\" value=\"".$env{'form.showOnlyHomework'}."\" /> |
<input type=\"hidden\" name=\"showOnlyHomework\" value=\"".$env{'form.showOnlyHomework'}."\" /> |
<input type=\"submit\" value=\"".&mt('Sort by:')."\" /> |
".&mt('Sort by:')." |
<select name=\"sort\"> |
<select name=\"sort\" onChange=\"document.sortForm.submit()\"> |
<option value=\"default\" $selected{'default'}>".&mt('Default')."</option> |
<option value=\"default\"$selected{'default'}>".&mt('Default')."</option> |
<option value=\"title\" $selected{'title'} >".&mt('Title')."</option> |
<option value=\"title\"$selected{'title'} >".&mt('Title')."</option> |
<option value=\"duedate\" $selected{'duedate'}>".&mt('Duedate')."</option> |
<option value=\"duedate\"$selected{'duedate'}>".&mt('Duedate')."</option> |
<option value=\"discussion\" $selected{'discussion'}>".&mt('Has New Discussion')."</option> |
<option value=\"discussion\"$selected{'discussion'}>".&mt('Has New Discussion')."</option> |
</select> |
</select> |
</nobr> |
</span> |
</form>"); |
</form>"); |
# renderer call |
# renderer call |
my $renderArgs = { 'cols' => [0,1,2,3], |
my $renderArgs = { 'cols' => [0,1,2,3], |
Line 320 MENU
|
Line 331 MENU
|
# user knows there was no error. |
# user knows there was no error. |
if ($renderArgs->{'counter'} == 0) { |
if ($renderArgs->{'counter'} == 0) { |
if ($showOnlyHomework) { |
if ($showOnlyHomework) { |
$r->print("<p><font size='+1'>".&mt("All homework is currently completed").".</font></p>"); |
$r->print("<p><span class=\"LC_info\">".&mt("All homework is currently completed.")."</span></p>"); |
} else { # both jumpToFirstHomework and normal use the same: course must be empty |
} else { # both jumpToFirstHomework and normal use the same: course must be empty |
$r->print("<p><font size='+1'>This course is empty.</font></p>"); |
$r->print("<p><span class=\"LC_info\">".&mt("This course is empty.")."</span></p>"); |
} |
} |
} |
} |
#my $td=&tv_interval($t0); |
#my $td=&tv_interval($t0); |