Diff for /loncom/interface/loncommon.pm between versions 1.360 and 1.366

version 1.360, 2006/05/01 20:50:50 version 1.366, 2006/05/09 15:09:27
Line 2773  Inputs: Line 2773  Inputs:
   
 =item * $notitle, if true keep the nav controls, but remove the title bar  =item * $notitle, if true keep the nav controls, but remove the title bar
   
   =item * $no_inline_link, if true and in remote mode, don't show the 
            'Switch To Inline Menu' link
   
   
 =back  =back
   
Line 2785  other decorations will be returned. Line 2788  other decorations will be returned.
   
 sub bodytag {  sub bodytag {
     my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle,      my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle,
  $notopbar,$bgcolor,$notitle)=@_;   $notopbar,$bgcolor,$notitle,$no_inline_link)=@_;
   
     $title=&mt($title);      $title=&mt($title);
   
Line 2845  sub bodytag { Line 2848  sub bodytag {
     $env{'environment.middlename'}      $env{'environment.middlename'}
     $env{'environment.lastname'}      $env{'environment.lastname'}
     $env{'environment.generation'}      $env{'environment.generation'}
        
 </div>  </div>
 <div class="LC_title_bar_role">  <div class="LC_title_bar_role">
 $role  $role&nbsp;
 </div>  </div>
 <div class="LC_title_bar_realm">  <div class="LC_title_bar_realm">
 $realm  $realm&nbsp;
 </div>  </div>
 </td>  </td>
 ENDROLE  ENDROLE
Line 2932  ENDROLE Line 2936  ENDROLE
         $lonhttpdPort.$img.'" alt="'.$function.'" />';          $lonhttpdPort.$img.'" alt="'.$function.'" />';
   
     # Explicit link to get inline menu      # Explicit link to get inline menu
     my $menu='<br /><a href="/adm/remote?action=collapse">'.&mt('Switch to Inline Menu Mode').'</a>';      my $menu= ($no_inline_link?''
          :'<br /><a href="/adm/remote?action=collapse">'.&mt('Switch to Inline Menu Mode').'</a>');
     #      #
     if ($notitle) {      if ($notitle) {
  return $bodytag;   return $bodytag;
Line 3084  sub standard_css { Line 3089  sub standard_css {
     my $mail_other_hover     = '#669999';      my $mail_other_hover     = '#669999';
   
     return <<END;      return <<END;
 <style type="text/css">  
 h1, h2, h3, th { font-family: $sans }  h1, h2, h3, th { font-family: $sans }
 a:focus { color: red; background: yellow }   a:focus { color: red; background: yellow } 
 table.thinborder { border-collapse: collapse; }  table.thinborder { border-collapse: collapse; }
Line 3104  table#LC_top_nav, table#LC_menubuttons, Line 3108  table#LC_top_nav, table#LC_menubuttons,
   width: 100%;    width: 100%;
   background: $pgbg;    background: $pgbg;
   border: 0px;    border: 0px;
   border-spacing: 1px;    border-spacing: 2px 1px;
   padding: 0px;    padding: 0px;
   margin: 0px;    margin: 0px;
   border-collapse: separate;    border-collapse: separate;
Line 3112  table#LC_top_nav, table#LC_menubuttons, Line 3116  table#LC_top_nav, table#LC_menubuttons,
 table#LC_title_bar {  table#LC_title_bar {
   width: 100%;    width: 100%;
   border: 0;    border: 0;
   border-spacing: 3px;    border-spacing: 0px 1px;
   background: $pgbg;    background: $pgbg;
   font-family: $sans;    font-family: $sans;
     border-collapse: collapse;
 }  }
 table#LC_title_bar.LC_with_remote {  table#LC_title_bar.LC_with_remote {
   width: 100%;    width: 100%;
Line 3160  table#LC_top_nav td a, div#LC_top_nav a Line 3165  table#LC_top_nav td a, div#LC_top_nav a
   color: $font;    color: $font;
   font-family: $sans;    font-family: $sans;
 }  }
   table#LC_top_nav td.LC_top_nav_logo {
     background: $tabbg;
     text-align: right;
   }
 table#LC_breadcrumbs td {  table#LC_breadcrumbs td {
   background: $tabbg;    background: $tabbg;
   color: $font;    color: $font;
Line 3255  table.LC_mail_list tr.LC_mail_other { Line 3264  table.LC_mail_list tr.LC_mail_other {
 table.LC_mail_list tr.LC_mail_other:hover {  table.LC_mail_list tr.LC_mail_other:hover {
   background-color: $mail_other_hover;    background-color: $mail_other_hover;
 }  }
 </style>  
 END  END
 }  }
   
Line 3289  Inputs: $title - optional title for the Line 3297  Inputs: $title - optional title for the
 sub headtag {  sub headtag {
     my ($title,$head_extra,$args) = @_;      my ($title,$head_extra,$args) = @_;
           
       my $function = $args->{'function'} || &get_users_function();
       my $domain   = $args->{'domain'}   || &determinedomain();
       my $bgcolor  = $args->{'bgcolor'}  || &designparm($function.'.pgbg',$domain);
       my $url = join(':',$env{'user.name'},$env{'user.domain'},
      $env{'environment.color.timestamp'},
      $function,$domain,$bgcolor);
   
       $url = '/adm/css/'.&Apache::lonnet::escape($url).'.css';
   
     my $result =      my $result =
  '<head>'.   '<head>'.
  &standard_css($args->{'function'},$args->{'domain'},   '<link rel="stylesheet" type="text/css" href="'.$url.'" />'.
       $args->{'bgcolor'}).  
  &font_settings().   &font_settings().
  &Apache::lonhtmlcommon::htmlareaheaders();   &Apache::lonhtmlcommon::htmlareaheaders();
   
Line 3451  Inputs: $title - optional title for the Line 3467  Inputs: $title - optional title for the
                                     head -> skip the <html><head> generation                                      head -> skip the <html><head> generation
                                     body -> skip all <body> generation                                      body -> skip all <body> generation
   
                     no_inline_link -> if true and in remote mode, don't show the 
                                       'Switch To Inline Menu' link
   
 =back  =back
   
 =cut  =cut
Line 3486  sub start_page { Line 3505  sub start_page {
  $args->{'only_body'},      $args->{'domain'},   $args->{'only_body'},      $args->{'domain'},
  $args->{'force_register'}, $args->{'body_title'},   $args->{'force_register'}, $args->{'body_title'},
  $args->{'no_nav_bar'},     $args->{'bgcolor'},   $args->{'no_nav_bar'},     $args->{'bgcolor'},
  $args->{'no_title'});   $args->{'no_title'},       $args->{'no_inline_link'});
  }   }
     }      }
   
Line 3732  Returns number of sections. Line 3751  Returns number of sections.
   
 ###############################################  ###############################################
 sub get_sections {  sub get_sections {
     my ($cdom,$cnum,$sectioncount,$possible_roles) = @_;      my ($cdom,$cnum,$possible_roles) = @_;
     if (!($cdom && $cnum)) { return 0; }      if (!defined($cdom) || !defined($cnum)) {
     my $numsections = 0;          my $cid =  $env{'request.course.id'};
   
     if (!defined($possible_roles) || (grep/^st$/,@$possible_roles)) {   return if (!defined($cid));
   
           $cdom = $env{'course.'.$cid.'.domain'};
           $cnum = $env{'course.'.$cid.'.num'};
       }
   
       my %sectioncount;
   
       if (!defined($possible_roles) || (grep(/^st$/,@$possible_roles))) {
  my ($classlist) = &Apache::loncoursedata::get_classlist($cdom,$cnum);   my ($classlist) = &Apache::loncoursedata::get_classlist($cdom,$cnum);
  my $sec_index = &Apache::loncoursedata::CL_SECTION();   my $sec_index = &Apache::loncoursedata::CL_SECTION();
  my $status_index = &Apache::loncoursedata::CL_STATUS();   my $status_index = &Apache::loncoursedata::CL_STATUS();
  while (my ($student,$data) = each %$classlist) {   while (my ($student,$data) = each(%$classlist)) {
     my ($section,$status) = ($data->[$sec_index],      my ($section,$status) = ($data->[$sec_index],
      $data->[$status_index]);       $data->[$status_index]);
     unless ($section eq '-1' || $section =~ /^\s*$/) {      unless ($section eq '-1' || $section =~ /^\s*$/) {
  if (!defined($$sectioncount{$section})) { $numsections++; }   $sectioncount{$section}++;
  $$sectioncount{$section}++;  
     }      }
  }   }
     }      }
Line 3761  sub get_sections { Line 3787  sub get_sections {
  }   }
  if ($user =~ /^$role:[^:]*:[^:]*:(\w+)/) { $section=$1; }   if ($user =~ /^$role:[^:]*:[^:]*:(\w+)/) { $section=$1; }
  if (!defined($section) || $section eq '-1') { next; }   if (!defined($section) || $section eq '-1') { next; }
  if (!defined($$sectioncount{$section})) { $numsections++; }    $sectioncount{$section}++;
  $$sectioncount{$section}++;  
     }      }
     return $numsections;      return %sectioncount;
 }  }
   
 ###############################################  ###############################################
Line 3801  can be sent to &get_group_settings() to Line 3826  can be sent to &get_group_settings() to
 ###############################################  ###############################################
   
 sub coursegroups {  sub coursegroups {
     my ($curr_groups,$cdom,$cnum,$group) = @_;      my ($cdom,$cnum,$group) = @_;
     my $numgroups;  
     if (!defined($cdom) || !defined($cnum)) {      if (!defined($cdom) || !defined($cnum)) {
         my $cid =  $env{'request.course.id'};          my $cid =  $env{'request.course.id'};
   
    return if (!defined($cid));
   
         $cdom = $env{'course.'.$cid.'.domain'};          $cdom = $env{'course.'.$cid.'.domain'};
         $cnum = $env{'course.'.$cid.'.num'};          $cnum = $env{'course.'.$cid.'.num'};
     }      }
     %{$curr_groups} = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group);      my %curr_groups = &Apache::lonnet::get_coursegroups($cdom,$cnum,$group);
     my ($tmp) = keys(%{$curr_groups});      my ($tmp) = keys(%curr_groups);
     if ($tmp=~/^error:/) {      if ($tmp=~/^(con_lost|no_such_host|error: [^2] )/) {
         unless ($tmp eq 'error: 2 tie(GDBM) Failed while attempting dump') {   undef(%curr_groups);
             &logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.   &logthis('Error retrieving groups: '.$tmp.' in '.$cnum.':'.$cdom);
                                                                    $cdom);      } elsif ($tmp=~/^error: 2 /) {
         }   undef(%curr_groups);
         $numgroups = 0;  
     } else {  
         $numgroups = keys(%{$curr_groups});  
     }      }
     return $numgroups;      return %curr_groups;
 }  }
   
 ###############################################  ###############################################

Removed from v.1.360  
changed lines
  Added in v.1.366


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