Diff for /loncom/interface/lonfeedback.pm between versions 1.255.2.8 and 1.256

version 1.255.2.8, 2009/03/18 02:53:49 version 1.256, 2008/11/18 19:14:22
Line 27 Line 27
 #  #
 ###  ###
   
   =pod
   
   =head1 NAME
   
   Apache::lonfeedback.pm
   
   =head1 SYNOPSIS
   
   Handles feedback from students to instructors and system administrators.
   
   Provides a screenshot of the current resource, as well as previous attempts if the resource was a homework.
   
   Used by lonmsg.pm.
   
   This is part of the LearningOnline Network with CAPA project
   described at http://www.lon-capa.org.
   
   =head1 OVERVIEW
   
   None
   
   =head1 SUBROUTINES
   
   =over
   
   =item discussion_open()
   
   =item discussion_visible()
   
   =item list_discussion()
   
   =item send_feedback_link()
   
   =item send_message_link()
   
   =item action_links_bar()
   
   =item postingform_display()
   
   =item build_posting_display
   
   =item filter_regexp()
   
   =item get_post_contents()
   
   =item replicate_attachments()
   
   =item mail_screen()
   
   =item print_display_options()
   
   =item print_sortfilter_options()
   
   =item print_showposters()
   
   =item get_post_versions()
   
   =item get_post_attachments()
   
   =item fail_redirect()
   
   =item redirect_back()
   
   =item no_redirect_back()
   
   =item screen_header()
   
   =item resource_output()
   
   =item clear_out_html()
   
   =item assemble_email()
   
   =item feedback_available()
   
   =item send_msg()
   
   =item adddiscuss()
   
   =item get_discussion_info()
   
   =item show_preview()
   
   =item newline_to_br()
   
   =item generate_preview_button()
   
   =item modify_attachments()
   
   =item process_attachments()
   
   =item generate_attachments_button()
   
   =item extract_attachments()
   
   =item construct_attachmenturl()
   
   =item add_blog_checkbox()
   
   =item has_discussion()
   
   =item sort_filter_names()
   
   =item handler()
   
   =item blocked_reply_or_edit()
   
   =item wrap_symb()
   
   =item dewrapper()
   
   =item get_feedurl()
   
   =item get_feedurl_and_clean_symb()
   
   =item editing_allowed()
   
   =item check_group_priv()
   
   =item group_args()
   
   =item get_resource_title()
   
   =back
   
   =cut
   
 package Apache::lonfeedback;  package Apache::lonfeedback;
   
 use strict;  use strict;
Line 625  END Line 752  END
                             $filterchoice .= ' '.$role_types{$role}.',';                              $filterchoice .= ' '.$role_types{$role}.',';
                         }                          }
                         $filterchoice =~ s/,$//;                          $filterchoice =~ s/,$//;
                         $filterchoice .= '<br />'.('&nbsp;' x8);                          $filterchoice .= '<br />&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp;&nbsp&nbsp;';
                     }                      }
                     if ($statusfilter) {                      if ($statusfilter) {
                         $filterchoice .= '<i>'.&mt('status').'</i>-&nbsp;'.$status_types{$statusfilter};                          $filterchoice .= '<i>'.&mt('status').'</i>-&nbsp;'.$status_types{$statusfilter};
Line 794  sub action_links_bar { Line 921  sub action_links_bar {
             $discussion .= '&previous='.$prevread;              $discussion .= '&previous='.$prevread;
         }          }
         $discussion .= &group_args($group);          $discussion .= &group_args($group);
         $discussion .='">'.&mt('Sorting/Filtering options').'</a>'.('&nbsp;' x2);          $discussion .='">'.&mt('Sorting/Filtering options').'</a>&nbsp;&nbsp';
     } else {      } else {
         $discussion .= '<td align="left">';          $discussion .= '<td align="left">';
     }      }
Line 1618  END Line 1745  END
       $comment = &unescape($env{'form.comment'});        $comment = &unescape($env{'form.comment'});
       &process_attachments(\@currnewattach,\@currdelold,\@keepold);        &process_attachments(\@currnewattach,\@currdelold,\@keepold);
   }    }
   my $latexHelp=&Apache::loncommon::helpLatexCheatsheet(undef,undef,1);    my $latexHelp=&Apache::loncommon::helpLatexCheatsheet();
   my $send=&mt('Send');    my $send=&mt('Send');
   my $alert = &mt('Please select a feedback type.');    my $alert = &mt('Please select a feedback type.');
   my $js= <<END;    my $js= <<END;
Line 1795  sub print_display_options { Line 1922  sub print_display_options {
         'actn' => 'Action',          'actn' => 'Action',
         'deff' => 'Default for all discussions',          'deff' => 'Default for all discussions',
         'prca' => 'Preferences can be set for this discussion that determine ....',          'prca' => 'Preferences can be set for this discussion that determine ....',
         'whpo' => 'Which posts are displayed when you display this discussion board or resource, and',          'whpo' => 'Which posts are displayed when you display this bulletin board or resource, and',
         'unwh' => 'Under what circumstances posts are identified as "NEW", and',          'unwh' => 'Under what circumstances posts are identified as "NEW", and',
         'wipa' => 'Whether individual posts can be marked as read/unread',          'wipa' => 'Whether individual posts can be marked as read/unread',
         'allposts' => 'All posts',          'allposts' => 'All posts',
Line 1960  END Line 2087  END
        <td>$lt{$disctogg}</td>         <td>$lt{$disctogg}</td>
        <td><label><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td>         <td><label><input type="checkbox" name="disctogg" onClick="discdispChk('2')" />$lt{'chgt'} "$toggchange"</label></td>
 END  END
     my $save = &mt('Save');      my $save = &mt('Save Changes');
     $r->print(&Apache::loncommon::end_data_table_row());      $r->print(&Apache::loncommon::end_data_table_row());
     $r->print(&Apache::loncommon::end_data_table());      $r->print(&Apache::loncommon::end_data_table());
     $r->print(<<END);      $r->print(<<END);
Line 2152  $start_page Line 2279  $start_page
   </td>    </td>
   <td>&nbsp;</td>    <td>&nbsp;</td>
   <td align="center" valign="top">    <td align="center" valign="top">
    <select name="rolefilter" multiple="multiple" size="5">     <select name="rolefilter" multiple="true" size="5">
     <option value="all">$role_types{'all'}</option>      <option value="all">$role_types{'all'}</option>
     <option value="st">$role_types{'st'}</option>      <option value="st">$role_types{'st'}</option>
     <option value="cc">$role_types{'cc'}</option>      <option value="cc">$role_types{'cc'}</option>
Line 2164  $start_page Line 2291  $start_page
   </td>    </td>
   <td>&nbsp;</td>    <td>&nbsp;</td>
   <td align="center" valign="top">    <td align="center" valign="top">
    <select name="sectionpick" multiple="multiple" size="$numvisible">     <select name="sectionpick" multiple="true" size="$numvisible">
     $section_sel      $section_sel
    </select>     </select>
   </td>    </td>
   <td>&nbsp;</td>    <td>&nbsp;</td>
   <td align="center" valign="top">    <td align="center" valign="top">
    <select name="grouppick" multiple="multiple" size="$numvisible">     <select name="grouppick" multiple="true" size="$numvisible">
     $group_sel      $group_sel
    </select>     </select>
   </td>    </td>
Line 2889  sub show_preview { Line 3016  sub show_preview {
   
     my $end_page = &Apache::loncommon::end_page();      my $end_page = &Apache::loncommon::end_page();
   
     $r->print($start_page      $r->print($start_page.'<table border="2"><tr><td>'.
              .'<h1>'.&mt('Preview').'</h1>'        '<b>'.&mt('Subject').':</b> '.$subject.'<br /><br />'.
              .&Apache::lonhtmlcommon::start_pick_box()        $message.'</td></tr></table>'.$end_page);
              .&Apache::lonhtmlcommon::row_title(&mt('Subject'))  
              .$subject  
              .&Apache::lonhtmlcommon::row_closure()  
              .&Apache::lonhtmlcommon::row_title(&mt('Message'))  
              .$message  
              .&Apache::lonhtmlcommon::row_closure(1)  
              .&Apache::lonhtmlcommon::end_pick_box()  
              .$end_page  
     );  
 }  }
   
   
Line 3256  function setblogvalue() { Line 3374  function setblogvalue() {
 sub has_discussion {  sub has_discussion {
     my $resourcesref = shift;      my $resourcesref = shift;
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     if (defined($navmap)) {      my @allres=$navmap->retrieveResources();
         my @allres=$navmap->retrieveResources();      foreach my $resource (@allres) {
         foreach my $resource (@allres) {          if ($resource->hasDiscussion()) {
             if ($resource->hasDiscussion()) {              my $ressymb = $resource->wrap_symb();
                 my $ressymb = $resource->wrap_symb();              push(@{$resourcesref}, $ressymb);
                 if (ref($resourcesref) eq 'ARRAY') {  
                     push(@{$resourcesref}, $ressymb);  
                 }  
             }  
         }          }
     } else {  
         &Apache::lonnet::logthis('Has discussion check failed - could not create navmap object.');  
     }      }
     return;      return;
 }  }
Line 3314  sub handler { Line 3426  sub handler {
          ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','groupick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly','group','ref']);           ['hide','unhide','deldisc','postdata','preview','replydisc','editdisc','cmd','symb','onlyunread','allposts','onlyunmark','previous','markread','markonread','markondisp','toggoff','toggon','modifydisp','changes','navtime','navmaps','navurl','sortposts','applysort','rolefilter','statusfilter','sectionpick','groupick','posterlist','userpick','attach','origpage','currnewattach','deloldattach','keepold','allversions','export','sendmessageonly','group','ref']);
   my $group = $env{'form.group'};    my $group = $env{'form.group'};
   my %attachmax = (    my %attachmax = (
                     text => &mt('(128 KB max size)'),                      text => '(128 KB max size)',
                     num  => 131072,                      num  => 131072,
                   );                    );
   if ($env{'form.editdisc'}) {    if ($env{'form.editdisc'}) {
Line 3444  sub handler { Line 3556  sub handler {
       my %lt = &Apache::lonlocal::texthash(        my %lt = &Apache::lonlocal::texthash(
           'mnpa' => 'Marked "New" posts as read in a total of',            'mnpa' => 'Marked "New" posts as read in a total of',
           'robb' => 'resources/bulletin boards.',            'robb' => 'resources/bulletin boards.',
           'twnp' => 'There are currently no resources or discussion boards with unread discussion postings.'            'twnp' => 'There are currently no resources or bulletin boards with unread discussion postings.'
       );               );       
       foreach my $res (@resources) {        foreach my $res (@resources) {
           my $ressymb=$res;            my $ressymb=$res;
Line 3590  ENDREDIR Line 3702  ENDREDIR
   &Apache::lonnet::appenv({'environment.threadeddiscussion' => 'on'});    &Apache::lonnet::appenv({'environment.threadeddiscussion' => 'on'});
       } else {        } else {
    &Apache::lonnet::del('environment',['threadeddiscussion']);     &Apache::lonnet::del('environment',['threadeddiscussion']);
   &Apache::lonnet::delenv('environment.threadeddiscussion');    &Apache::lonnet::delenv('environment\.threadeddiscussion');
       }        }
       &redirect_back($r,$feedurl,&mt('Changed discussion view mode').'<br />',        &redirect_back($r,$feedurl,&mt('Changed discussion view mode').'<br />',
      '0','0','','',$env{'form.previous'},undef,undef,undef,       '0','0','','',$env{'form.previous'},undef,undef,undef,
Line 3669  ENDREDIR Line 3781  ENDREDIR
   } else {    } else {
 # ------------------------------------------------------------- Normal feedback  # ------------------------------------------------------------- Normal feedback
       my $feedurl=$env{'form.postdata'};        my $feedurl=$env{'form.postdata'};
       $feedurl=~s/^https?\:\/\///;        $feedurl=~s/^http\:\/\///;
       $feedurl=~s/^$ENV{'SERVER_NAME'}//;        $feedurl=~s/^$ENV{'SERVER_NAME'}//;
       $feedurl=~s/^$ENV{'HTTP_HOST'}//;        $feedurl=~s/^$ENV{'HTTP_HOST'}//;
       $feedurl=~s/\?.+$//;        $feedurl=~s/\?.+$//;

Removed from v.1.255.2.8  
changed lines
  Added in v.1.256


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