Diff for /loncom/interface/lonbulletin.pm between versions 1.28 and 1.29

version 1.28, 2005/02/17 08:29:42 version 1.29, 2005/04/07 06:56:22
Line 41  sub handler { Line 41  sub handler {
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     $r->send_http_header;      $r->send_http_header;
     return OK if $r->header_only;      return OK if $r->header_only;
     my $target=$ENV{'form.grade_target'};      my $target=$env{'form.grade_target'};
   
 # ------------------------------------------------------------ Print the screen  # ------------------------------------------------------------ Print the screen
     if ($target ne 'tex') {      if ($target ne 'tex') {
Line 52  $html Line 52  $html
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 ENDDOCUMENT  ENDDOCUMENT
 } else {  } else {
  $r->print(&Apache::lonprintout::print_latex_header($ENV{'form.latex_type'}));   $r->print(&Apache::lonprintout::print_latex_header($env{'form.latex_type'}));
     }      }
     my (undef,undef,undef,undef,$marker)=split(/\//,$r->uri);      my (undef,undef,undef,undef,$marker)=split(/\//,$r->uri);
 # Is this even in a course?  # Is this even in a course?
     unless ($ENV{'request.course.id'}) {      unless ($env{'request.course.id'}) {
  $r->print('</head><body>Not in a course</body></html>');   $r->print('</head><body>Not in a course</body></html>');
         return OK;          return OK;
     }      }
Line 68  ENDDOCUMENT Line 68  ENDDOCUMENT
         return OK;          return OK;
     }      }
   
     my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};      my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};      my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
   
 # --------------------------------------------------------- The syllabus fields  # --------------------------------------------------------- The syllabus fields
     my %syllabusfields=&Apache::lonlocal::texthash(      my %syllabusfields=&Apache::lonlocal::texthash(
Line 82  ENDDOCUMENT Line 82  ENDDOCUMENT
                 ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register','origpage']);                  ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register','origpage']);
 # ----------------------------------------------------- Force menu registration  # ----------------------------------------------------- Force menu registration
     my $addentries='';      my $addentries='';
     if ($ENV{'form.register'}) {      if ($env{'form.register'}) {
        $addentries=' onLoad="'.&Apache::lonmenu::loadevents();         $addentries=' onLoad="'.&Apache::lonmenu::loadevents();
        if ($ENV{'form.origpage'}) {         if ($env{'form.origpage'}) {
            $addentries .= "document.location='#newpost';";             $addentries .= "document.location='#newpost';";
        }         }
        $addentries .= '" onUnload="'.&Apache::lonmenu::unloadevents().'"';         $addentries .= '" onUnload="'.&Apache::lonmenu::unloadevents().'"';
        $r->print(&Apache::lonmenu::registerurl(1));         $r->print(&Apache::lonmenu::registerurl(1));
     } elsif ($ENV{'form.origpage'}) {      } elsif ($env{'form.origpage'}) {
          $addentries = "onLoad=\"document.location='#newpost';\"";           $addentries = "onLoad=\"document.location='#newpost';\"";
     }      }
 # --------------------------------------------------------------- Force Student  # --------------------------------------------------------------- Force Student
     my $forcestudent='';      my $forcestudent='';
     if ($ENV{'form.forcestudent'}) { $forcestudent='student'; }      if ($env{'form.forcestudent'}) { $forcestudent='student'; }
   
     my $forceedit='';      my $forceedit='';
     if ($ENV{'form.forceedit'}) { $forceedit='edit'; }      if ($env{'form.forceedit'}) { $forceedit='edit'; }
   
     my %syllabus=&Apache::lonnet::dump('bulletinpage_'.$marker,$dom,$crs);      my %syllabus=&Apache::lonnet::dump('bulletinpage_'.$marker,$dom,$crs);
                 
Line 105  ENDDOCUMENT Line 105  ENDDOCUMENT
     if ($target ne 'tex') {         if ($target ne 'tex') {   
  $r->print('</head>'.&Apache::loncommon::bodytag   $r->print('</head>'.&Apache::loncommon::bodytag
                   ("Bulletin Board/Discussion",$forcestudent,$addentries,'',$dom,                    ("Bulletin Board/Discussion",$forcestudent,$addentries,'',$dom,
                   $ENV{'form.register'}));                    $env{'form.register'}));
     }      }
     my $allowed=&Apache::lonnet::allowed('mdc',$ENV{'request.course.id'});      my $allowed=&Apache::lonnet::allowed('mdc',$env{'request.course.id'});
   
     my $privileged=$allowed;      my $privileged=$allowed;
     if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {      if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
Line 126  ENDDOCUMENT Line 126  ENDDOCUMENT
     .&mt('Edit').'</font></a>');      .&mt('Edit').'</font></a>');
       }         } 
   
       if (($ENV{'form.uploaddoc.filename'}) &&        if (($env{'form.uploaddoc.filename'}) &&
           ($ENV{'form.storeupl'}) && ($allowed)) {            ($env{'form.storeupl'}) && ($allowed)) {
    if ($ENV{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {     if ($env{'form.uploaddoc.filename'}=~/\.(gif|jpg|png|jpeg)$/i) {
       if ($syllabus{'uploaded.photourl'}) {        if ($syllabus{'uploaded.photourl'}) {
   &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});    &Apache::lonnet::removeuploadedurl($syllabus{'uploaded.photourl'});
       }        }
Line 138  ENDDOCUMENT Line 138  ENDDOCUMENT
           $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 (keys %syllabusfields) {
                my $field=$ENV{'form.'.$_};                 my $field=$env{'form.'.$_};
                $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{$_}=$field;

Removed from v.1.28  
changed lines
  Added in v.1.29


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