Diff for /loncom/interface/lonhtmlcommon.pm between versions 1.124 and 1.132

version 1.124, 2006/04/18 22:35:41 version 1.132, 2006/06/13 14:42:24
Line 60  use Time::Local; Line 60  use Time::Local;
 use Time::HiRes;  use Time::HiRes;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonnet;  use Apache::lonnet;
   use lib '/home/httpd/lib/perl/';
   use LONCAPA;
   
 ##############################################  ##############################################
 ##############################################  ##############################################
Line 93  sub authorbombs { Line 95  sub authorbombs {
   
 sub recent_filename {  sub recent_filename {
     my $area=shift;      my $area=shift;
     return 'nohist_recent_'.&Apache::lonnet::escape($area);      return 'nohist_recent_'.&escape($area);
 }  }
   
 sub store_recent {  sub store_recent {
Line 115  sub store_recent { Line 117  sub store_recent {
     }      }
 # store new value  # store new value
     &Apache::lonnet::put($file,{ $name =>       &Apache::lonnet::put($file,{ $name => 
  time.'&'.&Apache::lonnet::escape($value) });   time.'&'.&escape($value) });
 }  }
   
 sub remove_recent {  sub remove_recent {
Line 134  sub select_recent { Line 136  sub select_recent {
  unless ($_=~/^error\:/) {   unless ($_=~/^error\:/) {
     my $escaped = &Apache::loncommon::escape_url($_);      my $escaped = &Apache::loncommon::escape_url($_);
     $return.="\n<option value='$escaped'>".      $return.="\n<option value='$escaped'>".
  &Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]).   &unescape((split(/\&/,$recent{$_}))[1]).
  '</option>';   '</option>';
  }   }
     }      }
Line 158  sub get_recent { Line 160  sub get_recent {
     my $idx = 1;      my $idx = 1;
     foreach (reverse sort keys %time_hash) {      foreach (reverse sort keys %time_hash) {
        $return_hash{$time_hash{$_}} =         $return_hash{$time_hash{$_}} =
                   &Apache::lonnet::unescape((split(/\&/,$recent{$_}))[1]);                    &unescape((split(/\&/,$recent{$_}))[1]);
        if ($n && ($idx++ >= $n)) {last;}         if ($n && ($idx++ >= $n)) {last;}
     }      }
   
Line 178  sub get_recent { Line 180  sub get_recent {
 sub textbox {  sub textbox {
     my ($name,$value,$size,$special) = @_;      my ($name,$value,$size,$special) = @_;
     $size = 40 if (! defined($size));      $size = 40 if (! defined($size));
       $value = &HTML::Entities::encode($value,'<>&"');
     my $Str = '<input type="text" name="'.$name.'" size="'.$size.'" '.      my $Str = '<input type="text" name="'.$name.'" size="'.$size.'" '.
         'value="'.$value.'" '.$special.' />';          'value="'.$value.'" '.$special.' />';
     return $Str;      return $Str;
Line 524  sub get_date_from_form { Line 527  sub get_date_from_form {
     if (($year<70) || ($year>137)) { return undef; }      if (($year<70) || ($year>137)) { return undef; }
     if (defined($sec) && defined($min)   && defined($hour) &&      if (defined($sec) && defined($min)   && defined($hour) &&
         defined($day) && defined($month) && defined($year) &&          defined($day) && defined($month) && defined($year) &&
         eval(&timelocal($sec,$min,$hour,$day,$month,$year))) {          eval('&timelocal($sec,$min,$hour,$day,$month,$year)')) {
         return &timelocal($sec,$min,$hour,$day,$month,$year);          return &timelocal($sec,$min,$hour,$day,$month,$year);
     } else {      } else {
         return undef;          return undef;
Line 817  sub Create_PrgWin { Line 820  sub Create_PrgWin {
          function openpopwin () {           function openpopwin () {
          popwin=open(\'\',\'popwin\',\'width=400,height=100\');".           popwin=open(\'\',\'popwin\',\'width=400,height=100\');".
         "popwin.document.writeln(\'".$start_page.          "popwin.document.writeln(\'".$start_page.
               "<h4>$heading</h4>".                "<h4>$heading<\/h4>".
               "<form name=popremain>".                "<form name=\"popremain\" method=\"post\">".
               '<input type="text" size="'.$width.'" name="remaining" value="'.                '<input type="text" size="'.$width.'" name="remaining" value="'.
       &mt('Starting').'"></form>'.$end_page.        &mt('Starting').'" /><\\/form>'.$end_page.
               "\');".                "\');".
         "popwin.document.close();}".          "popwin.document.close();}".
         "\nwindow.setTimeout(openpopwin,0)</script>");          "\nwindow.setTimeout(openpopwin,0)</script>");
Line 945  sub r_print { Line 948  sub r_print {
 # ------------------------------------------------------- Puts directory header  # ------------------------------------------------------- Puts directory header
   
 sub crumbs {  sub crumbs {
     my ($uri,$target,$prefix,$form,$size,$noformat)=@_;      my ($uri,$target,$prefix,$form,$size,$noformat,$skiplast)=@_;
     if (! defined($size)) {      if (! defined($size)) {
         $size = '+2';          $size = '+2';
     }      }
Line 961  sub crumbs { Line 964  sub crumbs {
  foreach my $dir (split('/',$uri)) {   foreach my $dir (split('/',$uri)) {
             if (! $dir) { next; }              if (! $dir) { next; }
             $path .= $dir;              $path .= $dir;
     unless ($path eq $uri) { $path.='/'; }      if ($path eq $uri) {
    if ($skiplast) {
       $output.=$dir;
                       last;
    } 
       } else {
    $path.='/'; 
       }
             my $linkpath = &Apache::loncommon::escape_single($path);              my $linkpath = &Apache::loncommon::escape_single($path);
             if ($form) {              if ($form) {
  $linkpath=   $linkpath=
Line 995  var checkwin; Line 1005  var checkwin;
   
 function spellcheckerwindow() {  function spellcheckerwindow() {
     checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');      checkwin=window.open($nothing,'spellcheckwin','height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
     checkwin.document.writeln('$start_page<form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /></form>$end_page');      checkwin.document.writeln('$start_page<form name="spellcheckform" action="/adm/spellcheck" method="post"><input type="hidden" name="text" value="" /><\\/form>$end_page');
     checkwin.document.close();      checkwin.document.close();
 }  }
 // END LON-CAPA Internal -->  // END LON-CAPA Internal -->
Line 1078  sub disablelink { Line 1088  sub disablelink {
     if (defined($#fields)) {      if (defined($#fields)) {
  unless ($#fields>=0) { return ''; }   unless ($#fields>=0) { return ''; }
     }      }
     return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl=','<>&"').&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';      return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=off&returnurl=','<>&"').&escape($ENV{'REQUEST_URI'}).'">'.&mt('Disable WYSIWYG Editor').'</a>';
 }  }
   
 sub enablelink {  sub enablelink {
Line 1086  sub enablelink { Line 1096  sub enablelink {
     if (defined($#fields)) {      if (defined($#fields)) {
  unless ($#fields>=0) { return ''; }   unless ($#fields>=0) { return ''; }
     }      }
     return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=on&returnurl=','<>&"').&Apache::lonnet::escape($ENV{'REQUEST_URI'}).'">'.&mt('Enable WYSIWYG Editor').'</a>';      return '<a href="'.&HTML::Entities::encode('/adm/preferences?action=set_wysiwyg&wysiwyg=on&returnurl=','<>&"').&escape($ENV{'REQUEST_URI'}).'">'.&mt('Enable WYSIWYG Editor').'</a>';
 }  }
   
 # ----------------------------------------- Script to activate only some fields  # ----------------------------------------- Script to activate only some fields
Line 1165  returns: nothing Line 1175  returns: nothing
     my @Crumbs;      my @Crumbs;
           
     sub breadcrumbs {      sub breadcrumbs {
         my ($color,$component,$component_help,$function,$domain,$menulink,          my ($component,$component_help,$menulink,$helplink) = @_;
     $helplink) = @_;  
         if (! defined($color)) {  
             if (! defined($function)) {  
                 $function = &Apache::loncommon::get_users_function();  
             }  
             $color = &Apache::loncommon::designparm($function.'.tabbg',  
                                                     $domain);  
         }  
         #          #
         my $Str = "\n".          my $Str = "\n".'<table id="LC_breadcrumbs"><tr><td>';
             '<table width="100%" border="0" cellpadding="0" cellspacing="0">'.  
             '<tr><td bgcolor="'.$color.'">'.  
             '<font size="-1">';  
         #          #
         # Make the faq and bug data cascade          # Make the faq and bug data cascade
         my $faq = '';          my $faq = '';
Line 1233  returns: nothing Line 1232  returns: nothing
 #            $icons .= &Apache::loncommon::help_open_bug($bug);  #            $icons .= &Apache::loncommon::help_open_bug($bug);
 #        }  #        }
  if ($helplink ne 'nohelp') {   if ($helplink ne 'nohelp') {
     $icons .= &Apache::loncommon::help_open_menu($color,$component,$component_help,$function,$faq,$bug);      $icons .= &Apache::loncommon::help_open_menu(undef,$component,
    $component_help,
    undef,$faq,$bug);
  }   }
         if ($icons ne '') {          if ($icons ne '') {
             $Str .= $icons.'&nbsp;';              $Str .= $icons.'&nbsp;';
         }          }
         #          #
         $Str .= $links.'</font></td>';          $Str .= $links.'</td>';
         #          #
         if (defined($component)) {          if (defined($component)) {
             $Str .= '<td align="right" bgcolor="'.$color.'">'.              $Str .= '<td class="LC_breadcrumb_component">'.
                 '<font size="+1">'.&mt($component).'</font></td>';                  &mt($component).'</td>';
         }          }
         $Str .= '</tr></table>'."\n";          $Str .= '</tr></table>'."\n";
         #          #
Line 1438  sub course_select_row { Line 1439  sub course_select_row {
     |;      |;
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link      my $courseform='<b>'.&Apache::loncommon::selectcourse_link
                      ($formname,'pickcourse','pickdomain','coursedesc','',1).'</b>';                       ($formname,'pickcourse','pickdomain','coursedesc','',1).'</b>';
           $output .= '<input type="radio" name="coursepick" value="all" onclick="coursePick(this.form)" />'.&mt('All courses').'<br />';
     if ($totcodes > 0) {      if ($totcodes > 0) {
         $output .= '<input type="radio" name="coursepick" value="all" onclick="coursePick(this.form)" />'.&mt('All courses');  
         my $numtitles = @$codetitles;          my $numtitles = @$codetitles;
         if ($numtitles > 0) {          if ($numtitles > 0) {
             $output .= '<br /><input type="radio" name="coursepick" value="category" onclick="coursePick(this.form);alert('."'".&mt('Choose categories, from left to right')."'".')" />'.&mt('Pick courses by category:').' <br />';              $output .= '<input type="radio" name="coursepick" value="category" onclick="coursePick(this.form);alert('."'".&mt('Choose categories, from left to right')."'".')" />'.&mt('Pick courses by category:').' <br />';
             $output .= '<table><tr><td>'.$$codetitles[0].'<br />'."\n".              $output .= '<table><tr><td>'.$$codetitles[0].'<br />'."\n".
                '<select name="'.$$codetitles[0].                 '<select name="'.$$codetitles[0].
                '" onChange="setPick(this.form);courseSet('."'$$codetitles[0]'".')">'."\n".                 '" onChange="setPick(this.form);courseSet('."'$$codetitles[0]'".')">'."\n".

Removed from v.1.124  
changed lines
  Added in v.1.132


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