Diff for /loncom/interface/lonnavdisplay.pm between versions 1.1 and 1.14

version 1.1, 2006/10/10 20:16:26 version 1.14, 2010/03/10 21:25:50
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='';
  my $navstatus=&Apache::lonmenu::get_nav_status();   my $navstatus=&Apache::lonmenu::get_nav_status();
  if ($menu) {      my $nothing = &Apache::lonhtmlcommon::javascript_nothing();
     $menu=(<<MENU)      my $mainwindow='window.open('.$nothing.',"loncapaclient","",false);';
              swmenu=$menu      $menu=(<<MENU);
              swmenu.clearTimeout(swmenu.menucltim);           swmenu=$mainwindow
      $navstatus       $navstatus
 MENU  MENU
         } else {      $r->send_http_header;
     my $nothing = &Apache::lonhtmlcommon::javascript_nothing();  
     my $mainwindow='window.open('.$nothing.',"loncapaclient","",false);';  
     $menu=(<<MENU)  
              swmenu=$mainwindow  
      $navstatus  
 MENU  
  }  
         $r->send_http_header;  
  my $js =<<"ENDSUBM";   my $js =<<"ENDSUBM";
   <script type="text/javascript">    <script type="text/javascript">
      function submitthis() {       function submitthis() {
Line 109  ENDSUBM Line 102  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='';
  my $navstatus=&Apache::lonmenu::get_nav_status();   my $navstatus=&Apache::lonmenu::get_nav_status();
  if ($menu) {   if ($menu) {
     $r->print(<<MENU);      $r->print(<<MENU);
Line 132  MENU Line 125  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 147  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 225  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 255  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 280  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 291  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 323  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);

Removed from v.1.1  
changed lines
  Added in v.1.14


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>