Diff for /loncom/interface/loncommon.pm between versions 1.368 and 1.369

version 1.368, 2006/05/10 21:50:39 version 1.369, 2006/05/11 19:04:31
Line 64  use HTML::Entities; Line 64  use HTML::Entities;
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::loncoursedata();  use Apache::loncoursedata();
 use Apache::lontexconvert();  use Apache::lontexconvert();
   use LONCAPA;
   
 my $readit;  my $readit;
   
Line 709  sub help_open_menu { Line 710  sub help_open_menu {
     my $timestamp = time;      my $timestamp = time;
     foreach my $datum (\$color,\$function,\$topic,\$component_help,\$faq,      foreach my $datum (\$color,\$function,\$topic,\$component_help,\$faq,
        \$bug,\$origurl) {         \$bug,\$origurl) {
         $$datum = &Apache::lonnet::escape($$datum);          $$datum = &escape($$datum);
     }      }
     if (!$stayOnPage) {      if (!$stayOnPage) {
          $link = "javascript:helpMenu('open')";           $link = "javascript:helpMenu('open')";
Line 775  ENDTEMPLATE Line 776  ENDTEMPLATE
        $width,$height).' '.$template;         $width,$height).' '.$template;
  } else {   } else {
     my $help_text;      my $help_text;
     $help_text=&Apache::lonnet::unescape($topic);      $help_text=&unescape($topic);
     $template='<table><tr><td>'.      $template='<table><tr><td>'.
  &help_open_topic($component_help,$help_text,$stayOnPage,   &help_open_topic($component_help,$help_text,$stayOnPage,
  $width,$height).'</td><td>'.$template.   $width,$height).'</td><td>'.$template.
Line 803  sub help_open_bug { Line 804  sub help_open_bug {
     my $link='';      my $link='';
     my $template='';      my $template='';
     my $url=$Apache::lonnet::perlvar{'BugzillaHost'}.'enter_bug.cgi?product=LON-CAPA&bug_file_loc='.      my $url=$Apache::lonnet::perlvar{'BugzillaHost'}.'enter_bug.cgi?product=LON-CAPA&bug_file_loc='.
  &Apache::lonnet::escape($ENV{'REQUEST_URI'}).'&component='.$topic;   &escape($ENV{'REQUEST_URI'}).'&component='.$topic;
     if (!$stayOnPage)      if (!$stayOnPage)
     {      {
  $link = "javascript:void(open('$url', 'Bugzilla', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";   $link = "javascript:void(open('$url', 'Bugzilla', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";
Line 2024  sub screenname { Line 2025  sub screenname {
 # ------------------------------------------------------------- Message Wrapper  # ------------------------------------------------------------- Message Wrapper
   
 sub messagewrapper {  sub messagewrapper {
     my ($link,$username,$domain)=@_;      my ($link,$username,$domain,$subject,$text)=@_;
     return       return 
         '<a href="/adm/email?compose=individual&'.          '<a href="/adm/email?compose=individual&'.
         'recname='.$username.'&recdom='.$domain.'" '.          'recname='.$username.'&recdom='.$domain.
    '&subject='.&escape($subject).'&text='.&escape($text).'" '.
         'title="'.&mt('Send message').'">'.$link.'</a>';          'title="'.&mt('Send message').'">'.$link.'</a>';
 }  }
 # --------------------------------------------------------------- Notes Wrapper  # --------------------------------------------------------------- Notes Wrapper
Line 2394  sub get_previous_attempt { Line 2396  sub get_previous_attempt {
        } else {         } else {
   $value=$returnhash{$version.':'.$key};    $value=$returnhash{$version.':'.$key};
        }         }
        $prevattempts.='<td>'.&Apache::lonnet::unescape($value).'&nbsp;</td>';            $prevattempts.='<td>'.&unescape($value).'&nbsp;</td>';   
     }      }
  }   }
       }        }
Line 2406  sub get_previous_attempt { Line 2408  sub get_previous_attempt {
  } else {   } else {
   $value=$lasthash{$key};    $value=$lasthash{$key};
  }   }
  $value=&Apache::lonnet::unescape($value);   $value=&unescape($value);
  if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)}   if ($key =~/$regexp$/ && (defined &$gradesub)) {$value = &$gradesub($value)}
  $prevattempts.='<td>'.$value.'&nbsp;</td>';   $prevattempts.='<td>'.$value.'&nbsp;</td>';
       }        }
Line 2528  sub submlink { Line 2530  sub submlink {
  if (!$symb) { $symb=$cursymb; }   if (!$symb) { $symb=$cursymb; }
     }      }
     if (!$symb) { $symb=&Apache::lonnet::symbread(); }      if (!$symb) { $symb=&Apache::lonnet::symbread(); }
     $symb=&Apache::lonnet::escape($symb);      $symb=&escape($symb);
     if ($target) { $target="target=\"$target\""; }      if ($target) { $target="target=\"$target\""; }
     return '<a href="/adm/grades?&command=submission&'.      return '<a href="/adm/grades?&command=submission&'.
  'symb='.$symb.'&student='.$uname.   'symb='.$symb.'&student='.$uname.
Line 2574  sub pprmlink { Line 2576  sub pprmlink {
  if (!$symb) { $symb=$cursymb; }   if (!$symb) { $symb=$cursymb; }
     }      }
     if (!$symb) { $symb=&Apache::lonnet::symbread(); }      if (!$symb) { $symb=&Apache::lonnet::symbread(); }
     $symb=&Apache::lonnet::escape($symb);      $symb=&escape($symb);
     if ($target) { $target="target=\"$target\""; }      if ($target) { $target="target=\"$target\""; }
     return '<a href="/adm/parmset?&command=set&'.      return '<a href="/adm/parmset?&command=set&'.
  'symb='.$symb.'&uname='.$uname.   'symb='.$symb.'&uname='.$uname.
Line 3311  sub headtag { Line 3313  sub headtag {
    $env{'environment.color.timestamp'},     $env{'environment.color.timestamp'},
    $function,$domain,$bgcolor);     $function,$domain,$bgcolor);
   
     $url = '/adm/css/'.&Apache::lonnet::escape($url).'.css';      $url = '/adm/css/'.&escape($url).'.css';
   
     my $result =      my $result =
  '<head>'.   '<head>'.
Line 3919  sub get_group_settings { Line 3921  sub get_group_settings {
                         $content{$tool}{$function} = $value;                          $content{$tool}{$function} = $value;
                     }                      }
                 } elsif ($entry eq 'groupname') {                  } elsif ($entry eq 'groupname') {
                     $content{$entry}=&Apache::lonnet::unescape($value);                      $content{$entry}=&unescape($value);
                 } elsif (($entry eq 'roles') || ($entry eq 'types') ||                  } elsif (($entry eq 'roles') || ($entry eq 'types') ||
                          ($entry eq 'sectionpick') || ($entry eq 'defpriv')) {                           ($entry eq 'sectionpick') || ($entry eq 'defpriv')) {
                     push(@{$content{$entry}},$value);                      push(@{$content{$entry}},$value);
Line 4106  sub get_unprocessed_cgi { Line 4108  sub get_unprocessed_cgi {
   # $Apache::lonxml::debug=1;    # $Apache::lonxml::debug=1;
   foreach my $pair (split(/&/,$query)) {    foreach my $pair (split(/&/,$query)) {
     my ($name, $value) = split(/=/,$pair);      my ($name, $value) = split(/=/,$pair);
     $name = &Apache::lonnet::unescape($name);      $name = &unescape($name);
     if (!defined($possible_names) || (grep {$_ eq $name} @$possible_names)) {      if (!defined($possible_names) || (grep {$_ eq $name} @$possible_names)) {
       $value =~ tr/+/ /;        $value =~ tr/+/ /;
       $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
Line 4735  sub DrawBarGraph { Line 4737  sub DrawBarGraph {
     $Title  = '' if (! defined($Title));      $Title  = '' if (! defined($Title));
     $xlabel = '' if (! defined($xlabel));      $xlabel = '' if (! defined($xlabel));
     $ylabel = '' if (! defined($ylabel));      $ylabel = '' if (! defined($ylabel));
     $ValuesHash{$id.'.title'}    = &Apache::lonnet::escape($Title);      $ValuesHash{$id.'.title'}    = &escape($Title);
     $ValuesHash{$id.'.xlabel'}   = &Apache::lonnet::escape($xlabel);      $ValuesHash{$id.'.xlabel'}   = &escape($xlabel);
     $ValuesHash{$id.'.ylabel'}   = &Apache::lonnet::escape($ylabel);      $ValuesHash{$id.'.ylabel'}   = &escape($ylabel);
     $ValuesHash{$id.'.y_max_value'} = $Max;      $ValuesHash{$id.'.y_max_value'} = $Max;
     $ValuesHash{$id.'.NumBars'}  = $NumBars;      $ValuesHash{$id.'.NumBars'}  = $NumBars;
     $ValuesHash{$id.'.NumSets'}  = $NumSets;      $ValuesHash{$id.'.NumSets'}  = $NumSets;
Line 4817  sub DrawXYGraph { Line 4819  sub DrawXYGraph {
     $ylabel = '' if (! defined($ylabel));      $ylabel = '' if (! defined($ylabel));
     my %ValuesHash =       my %ValuesHash = 
         (          (
          $id.'.title'  => &Apache::lonnet::escape($Title),           $id.'.title'  => &escape($Title),
          $id.'.xlabel' => &Apache::lonnet::escape($xlabel),           $id.'.xlabel' => &escape($xlabel),
          $id.'.ylabel' => &Apache::lonnet::escape($ylabel),           $id.'.ylabel' => &escape($ylabel),
          $id.'.y_max_value'=> $Max,           $id.'.y_max_value'=> $Max,
          $id.'.labels'     => join(',',@$Xlabels),           $id.'.labels'     => join(',',@$Xlabels),
          $id.'.PlotType'   => 'XY',           $id.'.PlotType'   => 'XY',
Line 4914  sub DrawXYYGraph { Line 4916  sub DrawXYYGraph {
     $ylabel = '' if (! defined($ylabel));      $ylabel = '' if (! defined($ylabel));
     my %ValuesHash =       my %ValuesHash = 
         (          (
          $id.'.title'  => &Apache::lonnet::escape($Title),           $id.'.title'  => &escape($Title),
          $id.'.xlabel' => &Apache::lonnet::escape($xlabel),           $id.'.xlabel' => &escape($xlabel),
          $id.'.ylabel' => &Apache::lonnet::escape($ylabel),           $id.'.ylabel' => &escape($ylabel),
          $id.'.labels' => join(',',@$Xlabels),           $id.'.labels' => join(',',@$Xlabels),
          $id.'.PlotType' => 'XY',           $id.'.PlotType' => 'XY',
          $id.'.NumSets' => 2,           $id.'.NumSets' => 2,
Line 4988  Inputs: Line 4990  Inputs:
 sub chartlink {  sub chartlink {
     my ($linktext, $sname, $sdomain) = @_;      my ($linktext, $sname, $sdomain) = @_;
     my $link = '<a href="/adm/statistics?reportSelected=student_assessment'.      my $link = '<a href="/adm/statistics?reportSelected=student_assessment'.
         '&amp;SelectedStudent='.&Apache::lonnet::escape($sname.':'.$sdomain).          '&amp;SelectedStudent='.&escape($sname.':'.$sdomain).
         '&amp;chartoutputmode='.HTML::Entities::encode('html, with all links').          '&amp;chartoutputmode='.HTML::Entities::encode('html, with all links').
        '">'.$linktext.'</a>';         '">'.$linktext.'</a>';
 }  }
Line 5051  sub store_course_settings { Line 5053  sub store_course_settings {
                 if (ref($env{'form.'.$setting})) {                  if (ref($env{'form.'.$setting})) {
                     $stored_form = join(',',                      $stored_form = join(',',
                                         map {                                          map {
                                             &Apache::lonnet::escape($_);                                              &escape($_);
                                         } sort(@{$env{'form.'.$setting}}));                                          } sort(@{$env{'form.'.$setting}}));
                 } else {                  } else {
                     $stored_form =                       $stored_form = 
                         &Apache::lonnet::escape($env{'form.'.$setting});                          &escape($env{'form.'.$setting});
                 }                  }
                 # Determine if the array contents are the same.                  # Determine if the array contents are the same.
                 if ($stored_form ne $env{$envname}) {                  if ($stored_form ne $env{$envname}) {
Line 5089  sub restore_course_settings { Line 5091  sub restore_course_settings {
             } elsif ($type eq 'array') {              } elsif ($type eq 'array') {
                 $env{'form.'.$setting} = [                   $env{'form.'.$setting} = [ 
                                            map {                                              map { 
                                                &Apache::lonnet::unescape($_);                                                  &unescape($_); 
                                            } split(',',$env{$envname})                                             } split(',',$env{$envname})
                                            ];                                             ];
             }              }
Line 5162  sub escape_double { Line 5164  sub escape_double {
 sub escape_url {  sub escape_url {
     my ($url)   = @_;      my ($url)   = @_;
     my @urlslices = split(/\//, $url,-1);      my @urlslices = split(/\//, $url,-1);
     my $lastitem = &Apache::lonnet::escape(pop(@urlslices));      my $lastitem = &escape(pop(@urlslices));
     return join('/',@urlslices).'/'.$lastitem;      return join('/',@urlslices).'/'.$lastitem;
 }  }
 =pod  =pod

Removed from v.1.368  
changed lines
  Added in v.1.369


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