Diff for /loncom/interface/lonbulletin.pm between versions 1.37 and 1.44

version 1.37, 2006/07/17 21:59:24 version 1.44, 2007/07/03 00:12:30
Line 36  use Apache::lontexconvert; Line 36  use Apache::lontexconvert;
 use Apache::lonfeedback;  use Apache::lonfeedback;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonhtmlcommon;  use Apache::lonhtmlcommon;
   use HTML::Entities();
 use LONCAPA;  use LONCAPA;
   
 sub handler {  sub handler {
Line 197  sub handler { Line 198  sub handler {
       if ($syllabus{'uploaded.photourl'}) {        if ($syllabus{'uploaded.photourl'}) {
   &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});    &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
       }        }
       $syllabus{'uploaded.photourl'}=                if ($group ne '') {
   &Apache::lonnet::userfileupload('uploaddoc',1,'bulletin');            $syllabus{'uploaded.photourl'}=
         &Apache::lonnet::userfileupload('uploaddoc',1,
                                                         'bulletin/'.$group.'/'.$marker);
                 } else {
                     $syllabus{'uploaded.photourl'}=
                         &Apache::lonnet::userfileupload('uploaddoc',1,
                                                         'bulletin/'.$marker);
                 }
    }     }
           $syllabus{'uploaded.lastmodified'}=time;            $syllabus{'uploaded.lastmodified'}=time;
           &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs);            &Apache::lonnet::put('bulletinpage_'.$marker,\%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};
                $field=~s/\s+$//s;                 $field=~s/\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('bulletinpage_'.$marker,\%syllabus,$dom,$crs);             &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs);
Line 231  sub handler { Line 239  sub handler {
          '<input type="submit" name="storeupl" value="'.&mt('Upload').'">'.           '<input type="submit" name="storeupl" value="'.&mt('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{$_};                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 241  sub handler { Line 249  sub handler {
   $message=&Apache::lonspeller::markeduptext($message);    $message=&Apache::lonspeller::markeduptext($message);
       }        }
       $message=&Apache::lontexconvert::msgtexconverted($message);        $message=&Apache::lontexconvert::msgtexconverted($message);
       unless ($_ eq 'aaa_title') {        unless ($field eq 'aaa_title') {
  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 {
  $r->print('\\\\\textbf{'.$syllabusfields{$_}.'}\\\\');   $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\');
     }      }
  }   }
  if ($target ne 'tex') {   if ($target ne 'tex') {
Line 256  sub handler { Line 264  sub handler {
     $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$message).' ');      $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$message).' ');
  }   }
                  if ($allowed) {                   if ($allowed) {
                 $r->print('<br /><textarea cols="80" rows="10" name="'.$_.'">'.                  $r->print('<br /><textarea cols="80" rows="10" name="'.$field.'">'.
    $syllabus{$_}.    &HTML::Entities::encode($syllabus{$field},'&"<>').
            '</textarea><input type="submit" name="storesyl" value="'.&mt('Store').'" />');             '</textarea><input type="submit" name="storesyl" value="'.&mt('Save').'" />');
         }          }
     } else {      } else {
                 if ($target ne 'tex') {                  if ($target ne 'tex') {
Line 268  sub handler { Line 276  sub handler {
  }   }
                 if ($allowed) {                  if ($allowed) {
                  $r->print(                   $r->print(
                 '<br />'.&mt('Topic').'<br /><textarea cols="80" rows="2" name="'.$_.'">'.                  '<br />'.&mt('Topic').'<br /><textarea cols="80" rows="2" name="'.$field.'">'.
    $syllabus{$_}.    &HTML::Entities::encode($syllabus{$field},'&"<>').
            '</textarea><input type="submit" name="storesyl" value="'.&mt('Store').'" />');             '</textarea><input type="submit" name="storesyl" value="'.&mt('Save').'" />');
                 }                  }
             }              }
   }    }

Removed from v.1.37  
changed lines
  Added in v.1.44


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