Diff for /loncom/interface/lonsimplepage.pm between versions 1.45 and 1.48

version 1.45, 2006/07/20 03:11:52 version 1.48, 2006/10/23 18:48:47
Line 38  use Apache::lonlocal; Line 38  use Apache::lonlocal;
 use Apache::lonprintout;  use Apache::lonprintout;
 use Apache::lonxml;  use Apache::lonxml;
 use Apache::longroup;  use Apache::longroup;
   use HTML::Entities();
 use LONCAPA;  use LONCAPA;
   
 sub handler {  sub handler {
Line 182  sub handler { Line 183  sub handler {
     }      }
   
     if ($forcestudent or $target eq 'tex') { $allowed=0; }      if ($forcestudent or $target eq 'tex') { $allowed=0; }
       
     if ($allowed) {      if ($allowed) {
  $r->print('<p>'.   $r->print('<p>'.
   &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1'.$refarg.'"><font size="+1">'.&mt('Show Student View').'</font></a>'.    &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes','Help with filling in text boxes').'<br /><a href="'.$r->uri.'?forcestudent=1'.$refarg.'"><font size="+1">'.&mt('Show Student View').'</font></a>'.
Line 220  sub handler { Line 221  sub handler {
  &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);   &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);
     }      }
     if (($allowed) && ($env{'form.storesyl'})) {      if (($allowed) && ($env{'form.storesyl'})) {
  foreach (keys %syllabusfields) {   foreach my $syl_field (keys(%syllabusfields)) {
     my $field=$env{'form.'.$_};      my $field=$env{'form.'.$syl_field};
     chomp($field);      chomp($field);
     $field=~s/\s+$//s;      $field=~s/\s+$//s;
     $field=~s/^\s+//s;      $field=~s/^\s+//s;
     $field=~s/\<br\s*\/*\>$//s;      $field=~s/\<br\s*\/*\>$//s;
     $field=&Apache::lonfeedback::clear_out_html($field,1);      $field=&Apache::lonfeedback::clear_out_html($field,1);
     $syllabus{$_}=$field;      $syllabus{$syl_field}=$field;
  }   }
  $syllabus{'uploaded.lastmodified'}=time;   $syllabus{'uploaded.lastmodified'}=time;
  &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);   &Apache::lonnet::put($namespace,\%syllabus,$dom,$crs);
Line 235  sub handler { Line 236  sub handler {
   
 # ---------------------------------------------------------------- Get syllabus  # ---------------------------------------------------------------- Get syllabus
     if ((($syllabus{'uploaded.lastmodified'}) &&       if ((($syllabus{'uploaded.lastmodified'}) && 
          (($group ne '' && ($group_home_view || $group_edit_perm ||            (($group ne '' && ($group_home_view || $group_edit_perm ||  
            $group_view_perm)) || ($group eq ''))) || ($allowed)) {              $group_view_perm)) || ($group eq ''))) || ($allowed)) {
  if ($syllabus{'uploaded.photourl'}) {   if ($syllabus{'uploaded.photourl'}) {
     &Apache::lonnet::allowuploaded('/adm/smppg',      &Apache::lonnet::allowuploaded('/adm/smppg',
    $syllabus{'uploaded.photourl'});     $syllabus{'uploaded.photourl'});
Line 257  sub handler { Line 258  sub handler {
       '<input type="submit" name="storeupl" value="Upload">'.        '<input type="submit" name="storeupl" value="Upload">'.
       '</form><form method="post">');        '</form><form method="post">');
  }   }
  foreach (sort keys %syllabusfields) {   foreach my $field (sort(keys(%syllabusfields))) {
     if (($syllabus{$_}) || ($allowed)) {      if (($syllabus{$field}) || ($allowed) || 
  my $message=$syllabus{$_};                  ($field eq 'abb_links' && $group ne '')) {
    my $message=$syllabus{$field};
  &Apache::lonfeedback::newline_to_br(\$message);   &Apache::lonfeedback::newline_to_br(\$message);
  $message   $message
     =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;      =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;
Line 267  sub handler { Line 269  sub handler {
     $message=&Apache::lonspeller::markeduptext($message);      $message=&Apache::lonspeller::markeduptext($message);
  }   }
  $message=&Apache::lontexconvert::msgtexconverted($message);   $message=&Apache::lontexconvert::msgtexconverted($message);
                 if ($_ eq 'abb_links' && $group ne '') {                  if ($field eq 'abb_links' && $group ne '') {
                     $r->print('<br /><input type="hidden" name="'.$_.                      $r->print('<br /><input type="hidden" name="'.$field.
                                           '" value="'.$syllabus{$_}.'" />');                                            '" value="'.$syllabus{$field}.'" />');
                     &display_group_links($r,$target,$group,'edit',$refarg,                      &display_group_links($r,$target,$group,'edit',$refarg,
                                          %groupinfo);                                           %groupinfo);
                     $r->print('<br />');                      $r->print('<br />');
                 } elsif ($_ eq 'aaa_title') {                  } elsif ($field eq 'aaa_title') {
                     if ($target ne 'tex') {                      if ($target ne 'tex') {
                         $r->print('<h1>'.$message.'</h1>');                          $r->print('<h1>'.$message.'</h1>');
                     } else {                      } else {
Line 283  sub handler { Line 285  sub handler {
                     if ($allowed) {                      if ($allowed) {
                         if ($env{'form.grade_target'} ne 'tex') {                          if ($env{'form.grade_target'} ne 'tex') {
                             $r->print(                              $r->print(
                                       '<br />Title<br /><textarea cols="80" rows="2" name="'.$_.'">'.                                        '<br />Title<br /><textarea cols="80" rows="2" name="'.$field.'">'.
                                       $syllabus{$_}.                                        &HTML::Entities::encode($syllabus{$field},'"&<>').
                                       '</textarea><input type="submit" name="storesyl" value="Store" />');                                        '</textarea><input type="submit" name="storesyl" value="Store" />');
                         } else {                          } else {
                             my $safeinit;                              my $safeinit;
                             $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$_},$safeinit));                              $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$field},$safeinit));
                         }                          }
                     }                      }
                 } else {                  } else {
     if (($_ ne 'bbb_content') || ($allowed)) {      if (($field ne 'bbb_content') || ($allowed)) {
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $r->print('<h3>'.$syllabusfields{$_}.'</h3>');      $r->print('<h3>'.$syllabusfields{$field}.'</h3>');
  } else {   } else {
     my $safeinit;      my $safeinit;
     $r->print(&Apache::lonxml::xmlparse($r,'tex','<h3>'.$syllabusfields{$_}.'</h3>'));      $r->print(&Apache::lonxml::xmlparse($r,'tex','<h3>'.$syllabusfields{$field}.'</h3>'));
  }   }
     }      }
     if ($target ne 'tex') {      if ($target ne 'tex') {
Line 309  sub handler { Line 311  sub handler {
     }      }
     if ($allowed) {      if ($allowed) {
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $r->print('<br /><textarea cols="80" rows="24" name="'.$_.'" id="'.$_.'">'.      $r->print('<br /><textarea cols="80" rows="24" name="'.$field.'" id="'.$field.'">'.
       $syllabus{$_}.                                        &HTML::Entities::encode($syllabus{$field},'"&<>').
       '</textarea><input type="submit" name="storesyl" value="Store" />');        '</textarea><input type="submit" name="storesyl" value="Store" />');
  } else {   } else {
     my $safeinit;      my $safeinit;
     $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$_},$safeinit));      $r->print(&Apache::lonxml::xmlparse($r,'tex',$syllabus{$field},$safeinit));
  }   }
     }      }
  }   }

Removed from v.1.45  
changed lines
  Added in v.1.48


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