Diff for /loncom/interface/loncommon.pm between versions 1.122 and 1.127

version 1.122, 2003/09/20 13:21:45 version 1.127, 2003/10/09 22:07:08
Line 80  my $readit; Line 80  my $readit;
   
 # ----------------------------------------------- Filetypes/Languages/Copyright  # ----------------------------------------------- Filetypes/Languages/Copyright
 my %language;  my %language;
   my %supported_language;
 my %cprtag;  my %cprtag;
 my %fe; my %fd;  my %fe; my %fd;
 my %category_extensions;  my %category_extensions;
Line 146  BEGIN { Line 147  BEGIN {
     while (<$fh>) {      while (<$fh>) {
  next if /^\#/;   next if /^\#/;
  chomp;   chomp;
  my ($key,$two,$country,$three,$enc,$val)=(split(/\t/,$_));   my ($key,$two,$country,$three,$enc,$val,$sup)=(split(/\t/,$_));
  $language{$key}=$val.' - '.$enc;   $language{$key}=$val.' - '.$enc;
    if ($sup) {
       $supported_language{$key}=$sup;
    }
     }      }
  }   }
     }      }
Line 1505  returns description of a specified langu Line 1509  returns description of a specified langu
 =cut  =cut
   
 sub languagedescription {  sub languagedescription {
     return $language{shift(@_)};      my $code=shift;
       return  ($supported_language{$code}?'* ':'').
               $language{$code}.
       ($supported_language{$code}?' ('.&mt('interface available').')':'');
 }  }
   
 =pod  =pod
Line 2321  sub no_cache { Line 2328  sub no_cache {
   #$r->header_out("Expires" => $date);    #$r->header_out("Expires" => $date);
 }  }
   
   sub content_type {
     my ($r,$type,$charset) = @_;
     unless ($charset) {
         $charset=&Apache::lonlocal::current_encoding;
     }
     $r->content_type($type.($charset?'; charset='.$charset:''));
   }
   
 =pod  =pod
   
 =item * add_to_env($name,$value)   =item * add_to_env($name,$value) 
Line 2644  sub check_if_partid_hidden { Line 2659  sub check_if_partid_hidden {
     return undef;      return undef;
 }  }
   
   ############################################################
   ############################################################
   
   =pod
   
   =item DrawGraph
   
   Returns a link to cgi-bin/graph
   
   =cut
   
   ############################################################
   ############################################################
   sub DrawGraph {
       my ($Title,$xlabel,$ylabel,$Max,$values1,$values2)=@_;
       #
       my $identifier = time.'_'.int(rand(1000));
       if (! defined($values1) || ref($values1) ne 'ARRAY') {
           return '';
       }
       #
       $Title  = '' if (! defined($Title));
       $xlabel = '' if (! defined($xlabel));
       $ylabel = '' if (! defined($ylabel));
       $Title  = &Apache::lonnet::escape($Title);
       $xlabel = &Apache::lonnet::escape($xlabel);
       $ylabel = &Apache::lonnet::escape($ylabel);
       #
       my $data1 = join(',', @$values1);
       my $data2;
       if (defined($values2)) {
           $data2 = join(',', @$values2);
       }
       #
       my $NumBars = scalar(@$values1);
       $Max = 1 if ($Max < 1);
       if ( int($Max) < $Max ) {
           $Max++;
           $Max = int($Max);
       }
       #
       &Apache::lonnet::appenv($identifier.'.title'   => $Title,
                               $identifier.'.xlabel'  => $xlabel,
                               $identifier.'.ylabel'  => $ylabel,
                               $identifier.'.Max'     => $Max,
                               $identifier.'.NumBars' => $NumBars,
                               $identifier.'.data1'   => $data1,
                               $identifier.'.data2'   => $data2);
       return '<IMG src="/cgi-bin/graph.png?'.$identifier.'" border="1" />';
   }
   
   ############################################################
   ############################################################
   
 =pod  =pod
   
 =back  =back

Removed from v.1.122  
changed lines
  Added in v.1.127


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