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

version 1.50, 2009/11/26 05:21:43 version 1.60, 2010/06/05 22:07:05
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(          if ($env{'form.register'}) {
             '<p>'.              $query_str .= '&amp;register='.$env{'form.register'};
             &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>'.          }
              &Apache::loncommon::help_open_topic('Uploaded_Templates_PublicView').'</p>');          #Function Box for Edit Mode.
     }  elsif ($privileged and $target ne 'tex') {          my $functionbox = &Apache::lonhtmlcommon::start_funclist();
           $functionbox .=  &Apache::lonhtmlcommon::add_item_funclist(
                                '<a href="'.$r->uri.'?'.$query_str.'">'.&mt('Show Student View').'</a>'.
                                 &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">'          if ($env{'form.register'}) {
                      .&mt('Edit').'</font></a>');              $query_str .= '&amp;register='.$env{'form.register'};
           }
           #Functionbox for Student view.
           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 240  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);
         }          }
         foreach my $field (sort(keys(%syllabusfields))) {          #Image in Student view.
             if (($syllabus{$field}) || ($allowed)) {          elsif($syllabus{'uploaded.photourl'} && $target ne 'tex'){
                 my $message=$syllabus{$field};              $r->print('<img src="'.$syllabus{'uploaded.photourl'}.'" alt="'.&mt('Image').'"/>');
                 if (&Apache::lonfeedback::newline_to_br($message)) {          }
                 &Apache::lonfeedback::newline_to_br(\$message);          
                 }          my %custom_handlers = ( 'aaa_title' => sub {} );
                 $message   @htmlids = &Apache::lontemplate::print_template_fields($r, \%syllabus, \%syllabusfields, 
                     =~s/(https*\:\/\/[^\s]+)/\<a href=\"$1\"\>\<tt\>$1\<\/tt\>\<\/a\>/g;   $target, $allowed, Apache::lontemplate->RICH_TEXT_DETECT_HTML, \%custom_handlers);
                 if ($allowed) {  
                     $message=&Apache::lonspeller::markeduptext($message);  
                 }  
                 $message=&Apache::lontexconvert::msgtexconverted($message);  
                 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') {  
                         $r->print('<h1>'.$message.'</h1>');  
                     } else {  
                         $r->print('\\\\\textbf{'.&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>');          if ($target ne 'tex') {
              $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.60


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