Diff for /loncom/interface/lonbulletin.pm between versions 1.50 and 1.57

version 1.50, 2009/11/26 05:21:43 version 1.57, 2009/12/22 06:32:04
Line 177  sub handler { Line 177  sub handler {
     if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {      if (($syllabus{'uploaded.lastmodified'}) && (!$forceedit)) {
         $forcestudent='student';          $forcestudent='student';
     }      }
     if ($target ne 'tex') { $r->print('<table><tr><td>'); }  
     if ($forcestudent or $target eq 'tex') { $allowed=0; }      if ($forcestudent or $target eq 'tex') { $allowed=0; }
   
     if ($allowed) {      if ($allowed) {
Line 185  sub handler { Line 184  sub handler {
         if (($group ne '') && ($env{'form.group'} eq $group)) {          if (($group ne '') && ($env{'form.group'} eq $group)) {
             $query_str.='&amp;group='.$group.'&amp;'.$refarg;              $query_str.='&amp;group='.$group.'&amp;'.$refarg;
         }          }
         $r->print(          #Function Box for Edit Mode.
             '<p>'.          my $functionbox = &Apache::lonhtmlcommon::start_funclist();
             &Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')).'<br /><a href="'.$r->uri.'?'.$query_str.'"><font size="+1">'.&mt('Show Student View').'</font></a>'.          $functionbox .=  &Apache::lonhtmlcommon::add_item_funclist(
              &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');                               '<a href="'.$r->uri.'?'.$query_str.'">'.&mt('Show Student View').'</a>'.
     }  elsif ($privileged and $target ne 'tex') {                                &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView'));
           $functionbox.=&Apache::lonhtmlcommon::end_funclist();
           $r->print(&Apache::loncommon::head_subbox($functionbox).&Apache::loncommon::help_open_topic('Uploaded_Templates_TextBoxes',&mt('Help with filling in text boxes')));
       } elsif ($privileged and $target ne 'tex') {
         my $query_str = 'forceedit=edit';          my $query_str = 'forceedit=edit';
         if (($group ne '') && ($env{'form.group'} eq $group)) {          if (($group ne '') && ($env{'form.group'} eq $group)) {
             $query_str.='&amp;group='.$group.'&amp;'.$refarg;              $query_str.='&amp;group='.$group.'&amp;'.$refarg;
         }          }
         $r->print('<a href="'.$r->uri.'?'.$query_str.'"><font size="+1">'          #Functionbox for Student view.
                      .&mt('Edit').'</font></a>');          my $functionbox = &Apache::lonhtmlcommon::start_funclist();
           $functionbox .=  &Apache::lonhtmlcommon::add_item_funclist(
                                "<a href='".$r->uri.'?'.$query_str."'>".&mt('Edit')."</a>");
           $functionbox.=&Apache::lonhtmlcommon::end_funclist();
           $r->print(&Apache::loncommon::head_subbox($functionbox));
     }      }
   
     if (($env{'form.uploaddoc.filename'}) &&      if (($env{'form.uploaddoc.filename'}) &&
Line 228  sub handler { Line 234  sub handler {
         &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs);          &Apache::lonnet::put('bulletinpage_'.$marker,\%syllabus,$dom,$crs);
     }      }
   
 # ---------------------------------------------------------------- Get syllabus  # ---------------------------------------------------------------- Get discussion board
     if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {      if (($syllabus{'uploaded.lastmodified'}) || ($allowed)) {
           #Print Topic as Heading
           my $titletext=&HTML::Entities::encode($syllabus{'aaa_title'},'<>&"');;
           if ($target ne 'tex') {
               $r->print('<h2>'.$titletext.'</h2>');
           } else {
               $r->print('\\\\\textbf{'.&Apache::lonxml::xmlparse($r,'tex',$titletext).'}\\\\');
           }
           #Outputbox and Inputbox for Topic
           if ($allowed) {
               $r->print('<form method="post" action="" enctype="multipart/form-data">');
               &Apache::lontemplate::print_start_template($r,&mt('Title'),'LC_Box');
               $r->print($titletext);
    $r->print("<br /><div>");
    &Apache::lontemplate::print_textarea_template($r, $syllabus{'aaa_title'},
    'aaa_title', Apache::lontemplate->RICH_TEXT_ALWAYS_OFF);
    &Apache::lontemplate::print_saveall_template($r);
    $r->print("</div>");
    &Apache::lontemplate::print_end_template($r);
           }
         if ($syllabus{'uploaded.photourl'}) {          if ($syllabus{'uploaded.photourl'}) {
             &Apache::lonnet::allowuploaded('/adm/syllabus',              &Apache::lonnet::allowuploaded('/adm/syllabus',
                                            $syllabus{'uploaded.photourl'});                                             $syllabus{'uploaded.photourl'});
             $r->print('<img src="'.$syllabus{'uploaded.photourl'}.  
             '" align="right" />');  
         }          }
           my @htmlids=();
           #Outputbox and Inputbox for Image upload
         if ($allowed) {          if ($allowed) {
           my $message = '<img src="'.$syllabus{'uploaded.photourl'}.'" alt="'.&mt('Image').'"/>';
           &Apache::lontemplate::print_start_template($r, &mt('Upload a Photo'),'LC_Box');
               $r->print($message);
               $r->print("<br /><br />");
             $r->print(              $r->print(
                 '<form method="post" enctype="multipart/form-data">'.  
                 '<input type="hidden" name="forceedit" value="edit" />'.                  '<input type="hidden" name="forceedit" value="edit" />'.
                 '<h3>'.&mt('Upload a Photo').'</h3>'.  
                 '<input type="file" name="uploaddoc" size="50" />'.                  '<input type="file" name="uploaddoc" size="50" />'.
                 '<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'.                  '<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'.
                 '</form><form method="post">'.  
                 '<input type="hidden" name="forceedit" value="edit" />');                  '<input type="hidden" name="forceedit" value="edit" />');
               &Apache::lontemplate::print_end_template($r);
           }
           #Image in Student view.
           elsif($syllabus{'uploaded.photourl'} && $target ne 'tex'){
               $r->print('<img src="'.$syllabus{'uploaded.photourl'}.'" alt="'.&mt('Image').'"/>');
         }          }
         foreach my $field (sort(keys(%syllabusfields))) {          foreach my $field (sort(keys(%syllabusfields))) {
             if (($syllabus{$field}) || ($allowed)) {              if (($syllabus{$field}) || ($allowed)) {
                 my $message=$syllabus{$field};                  my $message=$syllabus{$field};
                 if (&Apache::lonfeedback::newline_to_br($message)) {                  if (!&Apache::lonfeedback::contains_block_html($message)) {
                 &Apache::lonfeedback::newline_to_br(\$message);                  &Apache::lonfeedback::newline_to_br(\$message);
                 }                  } else {
                 $message                      $message = &Apache::lonfeedback::tidy_html($message);
                     =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;   }
                   $message=&Apache::lonhtmlcommon::raw_href_to_link($message);
                 if ($allowed) {                  if ($allowed) {
                     $message=&Apache::lonspeller::markeduptext($message);                      $message=&Apache::lonspeller::markeduptext($message);
                 }                  }
                 $message=&Apache::lontexconvert::msgtexconverted($message);                  $message=&Apache::lontexconvert::msgtexconverted($message);
                 unless ($field eq 'aaa_title') {                  unless ($field eq 'aaa_title') {
                     if (($field ne 'bbb_content') || ($allowed)) {  
                         if ($target ne 'tex') {  
                             $r->print('<h3>'.$syllabusfields{$field}.'</h3>');  
                         } else {  
                             $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\');  
                         }  
                     }  
                     if ($target ne 'tex') {  
                         $r->print('<blockquote>'.  
                                   $message.'</blockquote>');  
                     } else {  
                         $r->print(' '.&Apache::lonxml::xmlparse($r,'tex',$message).' ');  
                     }  
                     if ($allowed) {  
                         $r->print('<br /><textarea cols="80" rows="10" name="'.$field.'">'.  
                                   &HTML::Entities::encode($syllabus{$field},'&"<>').  
                                   '</textarea><input type="submit" name="storesyl" value="'.&mt('Save').'" />');  
                     }  
                 } else {  
                     if ($target ne 'tex') {                      if ($target ne 'tex') {
                         $r->print('<h1>'.$message.'</h1>');   #output of syllabusfields will be generated here. 
    &Apache::lontemplate::print_start_template($r,$syllabusfields{$field},'LC_Box');
                           $r->print($message);
                           if ($allowed) {
                               $r->print("<br /><div>");
                               &Apache::lontemplate::print_textarea_template($r, $syllabus{$field},
                               $field, Apache::lontemplate->RICH_TEXT_DETECT_HTML);
                               &Apache::lontemplate::print_saveall_template($r);
    $r->print("</div>");
    } 
                       &Apache::lontemplate::print_end_template($r);
                       push(@htmlids,$field);
                     } else {                      } else {
                         $r->print('\\\\\textbf{'.&Apache::lonxml::xmlparse($r,'tex',$message).'}\\\\');                          $r->print('\\\\\textbf{'.$syllabusfields{$field}.'}\\\\'.&Apache::lonxml::xmlparse($r,'tex',$message));
                     }                      }
                     if ($allowed) {                  }   
                         $r->print(  
                             '<br />'.&mt('Topic').'<br /><textarea cols="80" rows="2" name="'.$field.'">'.  
                             &HTML::Entities::encode($syllabus{$field},'&"<>').  
                             '</textarea><input type="submit" name="storesyl" value="'.&mt('Save').'" />');  
                     }  
                 }  
             }              }
         }          }
         if ($allowed) {          if ($allowed) {
             $r->print('</form>');              $r->print('</form>'.
               &Apache::lonhtmlcommon::htmlareaselectactive(@htmlids));
           }
           if ($target ne 'tex'){
               $r->print('<br/><br/><hr/><br/>');
           }
           else {
               $r->print(&Apache::lonxml::xmlparse($r,'tex','<br/><br/><hr/><br/>'));
         }          }
         if ($target ne 'tex') {$r->print('</p>');} else {$r->print('\\\\');}  
     } else {      } else {
         $r->print('<p>'.&mt('No page information provided.').'</p>');          $r->print('<p>'.&mt('No page information provided.').'</p>');
     }      }
     if ($target ne 'tex') { $r->print('</td></tr></table>'); }      #Lists discussion posts and box for a new discussion post.
     if ($target ne 'tex') {      if ($target ne 'tex') {
         $r->print(&Apache::lonfeedback::list_discussion          $r->print(&Apache::lonfeedback::list_discussion
                       ('board','OPEN','bulletin___'.$marker.'___'.                        ('board','OPEN','bulletin___'.$marker.'___'.

Removed from v.1.50  
changed lines
  Added in v.1.57


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