Diff for /loncom/interface/lonfeedback.pm between versions 1.277 and 1.278

version 1.277, 2009/10/12 18:46:03 version 1.278, 2009/11/04 17:45:49
Line 172  sub list_discussion { Line 172  sub list_discussion {
   
     my $cdom = $env{'course.'.$cid.'.domain'};      my $cdom = $env{'course.'.$cid.'.domain'};
     my $cnum = $env{'course.'.$cid.'.num'};      my $cnum = $env{'course.'.$cid.'.num'};
       my $crstype = &Apache::loncommon::course_type();
   
 # Get information about students and non-students in course for filtering display of posts  # Get information about students and non-students in course for filtering display of posts
     my %roleshash = ();      my %roleshash = ();
Line 600  END Line 601  END
                 my %sort_types = ();                  my %sort_types = ();
                 my %role_types = ();                  my %role_types = ();
                 my %status_types = ();                  my %status_types = ();
                 &sort_filter_names(\%sort_types,\%role_types,\%status_types);                  &sort_filter_names(\%sort_types,\%role_types,\%status_types,$crstype);
   
                 $discussion .= '<td><font size="-1"><b>'.&mt('Sorted by').'</b>: '.$sort_types{$sortposts}.'<br />';                  $discussion .= '<td><font size="-1"><b>'.&mt('Sorted by').'</b>: '.$sort_types{$sortposts}.'<br />';
                 if (defined($env{'form.totposters'})) {                  if (defined($env{'form.totposters'})) {
Line 726  END Line 727  END
  &postingform_display($mode,$ressymb,$now,$subject,   &postingform_display($mode,$ressymb,$now,$subject,
      $comment,$outputtarget,$attachnum,       $comment,$outputtarget,$attachnum,
      $currnewattach,$currdelold,       $currnewattach,$currdelold,
      $group);       $group,$crstype);
                 }                  }
             } else {              } else {
         $discussion.=           $discussion.= 
     &postingform_display($mode,$ressymb,$now,$subject,      &postingform_display($mode,$ressymb,$now,$subject,
  $comment,$outputtarget,$attachnum,   $comment,$outputtarget,$attachnum,
  $currnewattach,$currdelold);   $currnewattach,$currdelold,'',$crstype);
             }              }
  }   }
     } else {      } else {
Line 827  sub action_links_bar { Line 828  sub action_links_bar {
   
 sub postingform_display {  sub postingform_display {
     my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,      my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
         $currnewattach,$currdelold,$group) = @_;          $currnewattach,$currdelold,$group,$crstype) = @_;
     my $newattachmsg;      my $newattachmsg;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
               'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',                'note' => 'Note: in anonymous discussion, your name is visible only to course faculty',
Line 836  sub postingform_display { Line 837  sub postingform_display {
              'poan' => 'Post Anonymous Discussion',               'poan' => 'Post Anonymous Discussion',
              'newa' => 'New attachments',               'newa' => 'New attachments',
     );      );
       if ($crstype eq 'Community') {
           $lt{'note'} = &mt('Note: in anonymous discussion, your name is visible only to community facilitators');
       }
     my $postingform = (<<ENDDISCUSS);      my $postingform = (<<ENDDISCUSS);
 <form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> <input type="submit" name="discuss" value="$lt{'podi'}" />  <form action="/adm/feedback" method="post" name="mailform" enctype="multipart/form-data"> <input type="submit" name="discuss" value="$lt{'podi'}" />
 <input type="submit" name="anondiscuss" value="$lt{'poan'}" /> <input type="hidden" name="symb" value="$ressymb" />  <input type="submit" name="anondiscuss" value="$lt{'poan'}" /> <input type="hidden" name="symb" value="$ressymb" />
Line 863  ENDDISCUSS Line 867  ENDDISCUSS
     }      }
     my $blockblog = &Apache::loncommon::blocking_status('blogs');      my $blockblog = &Apache::loncommon::blocking_status('blogs');
     if (!$blockblog) {      if (!$blockblog) {
         $postingform .= &add_blog_checkbox();          $postingform .= &add_blog_checkbox($crstype);
     }      }
     $postingform .= "</form>\n";      $postingform .= "</form>\n";
     if ($outputtarget ne 'tex') {      if ($outputtarget ne 'tex') {
Line 2012  sub print_sortfilter_options { Line 2016  sub print_sortfilter_options {
     my $group_sel = '';      my $group_sel = '';
     my $numgroupvis = 5;      my $numgroupvis = 5;
     my %sectioncount = &Apache::loncommon::get_sections();      my %sectioncount = &Apache::loncommon::get_sections();
       my @courseroles = qw(st ad ep ta in);
       my $crstype = &Apache::loncommon::course_type();
       my $ccrole = 'cc';
       if ($crstype eq 'Community') {
           $ccrole = 'co';
       }
       push(@courseroles,$ccrole);
       
     if ($env{'request.course.sec'} !~ /^\s*$/) {  #Restrict section choice to current section       if ($env{'request.course.sec'} !~ /^\s*$/) {  #Restrict section choice to current section 
         @sections = ('all',$env{'request.course.sec'});          @sections = ('all',$env{'request.course.sec'});
         $numvisible = 2;          $numvisible = 2;
Line 2075  sub print_sortfilter_options { Line 2086  sub print_sortfilter_options {
     my %sort_types = ();      my %sort_types = ();
     my %role_types = ();      my %role_types = ();
     my %status_types = ();      my %status_types = ();
     &sort_filter_names(\%sort_types,\%role_types,\%status_types);      &sort_filter_names(\%sort_types,\%role_types,\%status_types,$crstype);
   
     my $js = <<END;      my $js = <<END;
 <script type="text/javascript">  <script type="text/javascript">
Line 2164  $start_page Line 2175  $start_page
    <select name="rolefilter" multiple="multiple" size="5">     <select name="rolefilter" multiple="multiple" 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="$ccrole">$role_types{$ccrole}</option>
     <option value="in">$role_types{'in'}</option>      <option value="in">$role_types{'in'}</option>
     <option value="ta">$role_types{'ta'}</option>      <option value="ta">$role_types{'ta'}</option>
     <option value="ep">$role_types{'ep'}</option>      <option value="ep">$role_types{'ep'}</option>
       <option value="ad">$role_types{'ad'}</option>
     <option value="cr">$role_types{'cr'}</option>      <option value="cr">$role_types{'cr'}</option>
    </select>     </select>
   </td>    </td>
Line 2567  ENDNOREDIRTWO Line 2579  ENDNOREDIRTWO
   
 sub screen_header {  sub screen_header {
     my ($feedurl,$symb) = @_;      my ($feedurl,$symb) = @_;
       my $crscontent = &mt('Question/Comment/Feedback about course content');
       my $crspolicy = &mt('Question/Comment/Feedback about course policy');
       my $contribdisc = &mt('Contribution to course discussion of resource');
       my $anoncontrib = &mt('Anonymous contribution to course discussion of resource');
       my $namevis = &mt('name only visible to course faculty');
       my $crstype;
       if ($env{'request.course.id'}) {
           $crstype = &Apache::loncommon::course_type();
           if ($crstype eq 'Community') {
               $crscontent = &mt('Question/Comment/Feedback about community content');
               $crspolicy = &mt('Question/Comment/Feedback about community policy');
               $contribdisc = &mt('Contribution to community discussion of resource');
               $anoncontrib = &mt('Anonymous contribution to community discussion of resource');
               $namevis = &mt('name only visible to community facilitators');
           }
       }
     my $msgoptions='';      my $msgoptions='';
     my $discussoptions='';      my $discussoptions='';
     unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {      unless (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {
Line 2587  sub screen_header { Line 2615  sub screen_header {
  if (&feedback_available(0,1)) {   if (&feedback_available(0,1)) {
     $msgoptions.=      $msgoptions.=
  '<p><label><input type="radio" name="discuss" value="course" /> '.   '<p><label><input type="radio" name="discuss" value="course" /> '.
  ($optionhash{'comment'}?$optionhash{'comment'}:&mt('Question/Comment/Feedback about course content')).   ($optionhash{'comment'}?$optionhash{'comment'}:$crscontent).
  '</label></p>';   '</label></p>';
  }   }
  if (&feedback_available(0,0,1)) {   if (&feedback_available(0,0,1)) {
     $msgoptions.=      $msgoptions.=
  '<p><label><input type="radio" name="discuss" value="policy" /> '.   '<p><label><input type="radio" name="discuss" value="policy" /> '.
  ($optionhash{'policy'}?$optionhash{'policy'}:&mt('Question/Comment/Feedback about course policy')).   ($optionhash{'policy'}?$optionhash{'policy'}:$crspolicy).
  '</label></p>';   '</label></p>';
  }   }
     }      }
Line 2604  sub screen_header { Line 2632  sub screen_header {
      $env{'request.course.id'}.       $env{'request.course.id'}.
      ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {       ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
     $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.      $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
  &mt('Contribution to course discussion of resource');   $contribdisc.
         $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.          '</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
  &mt('Anonymous contribution to course discussion of resource').   $anoncontrib.
  ' <i>('.&mt('name only visible to course faculty').')</i></label> '.   ' <i>('.$namevis.')</i></label> '.
  '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';   '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
             my $blockblog = &Apache::loncommon::blocking_status('blogs');              my $blockblog = &Apache::loncommon::blocking_status('blogs');
             if (!$blockblog) {              if (!$blockblog) {
                 $discussoptions.= &add_blog_checkbox();                  $discussoptions.= &add_blog_checkbox($crstype);
             }              }
         }          }
     }      }
Line 2674  sub assemble_email { Line 2702  sub assemble_email {
              'orig' => 'Original screen output (if applicable)',               'orig' => 'Original screen output (if applicable)',
              'corr' => 'Correct Answer(s) (if applicable)',               'corr' => 'Correct Answer(s) (if applicable)',
   );    );
     if (&Apache::loncommon::course_type() eq 'Community') {
         $lt{'prev'} = &mt('Previous attempts of member (if applicable)');
     }
   my $email=<<"ENDEMAIL";    my $email=<<"ENDEMAIL";
 $message  $message
 ENDEMAIL  ENDEMAIL
Line 3255  sub construct_attachmenturl { Line 3286  sub construct_attachmenturl {
 }  }
   
 sub add_blog_checkbox {  sub add_blog_checkbox {
     my ($checkstatus);      my ($crstype) = @_;
       my $checkstatus;
     if ($env{'form.blog'}) {      if ($env{'form.blog'}) {
         $checkstatus = 'checked="checked"';          $checkstatus = 'checked="checked"';
     }      }
Line 3269  function setblogvalue() { Line 3301  function setblogvalue() {
     }      }
 }  }
 </script><br />  </script><br />
 <label><input type="checkbox" name="blog" '.$checkstatus.' /> '.  <label><input type="checkbox" name="blog" '.$checkstatus.' /> ';
 &mt('Add to my public course blog').'</label><br />'."\n";      if ($crstype eq 'Community') {
           $output .= &mt('Add to my public community blog');
       } else {
           $output .= &mt('Add to my public course blog');
       } 
       $output .= '</label><br />'."\n";
     return $output;      return $output;
 }  }
   
Line 3294  sub has_discussion { Line 3331  sub has_discussion {
 }  }
   
 sub sort_filter_names {  sub sort_filter_names {
     my ($sort_types,$role_types,$status_types) = @_;      my ($sort_types,$role_types,$status_types,$crstype) = @_;
     %{$sort_types} = (      if (ref($sort_types) eq 'HASH') {
           %{$sort_types} = (
                      ascdate => 'Date order - oldest first',                       ascdate => 'Date order - oldest first',
                      descdate => 'Date order - newest first',                       descdate => 'Date order - newest first',
                      thread => 'Threaded',                       thread => 'Threaded',
Line 3303  sub sort_filter_names { Line 3341  sub sort_filter_names {
                      username => 'By domain and username',                       username => 'By domain and username',
                      lastfirst => 'By last name, first name'                       lastfirst => 'By last name, first name'
                    );                     );
     %{$role_types} = (      }
                      all => 'All roles',      my @courseroles = qw(st in ta ep ad);
                      st  => 'Students',      if ($crstype eq 'Community') {
                      cc  => 'Course Coordinators',          push(@courseroles,'co');
                      in  => 'Instructors',      } else {
                      ta  => 'TAs',          push(@courseroles,'cc');
                      ep  => 'Exam proctors',      }
                      ad  => 'Administrators',      if (ref($role_types) eq 'HASH') {
                      cr  => 'Custom roles'          foreach my $role (@courseroles) {
                    );              $role_types->{$role} = &Apache::lonnet::plaintext($role,$crstype);
     %{$status_types} = (          }
           $role_types->{'all'} = 'All roles';
           $role_types->{'cr'} = 'Custom role';
       }
       if (ref($status_types) eq 'HASH') {
           %{$status_types} = (
                      all     => 'Roles of any status',                       all     => 'Roles of any status',
                      Active  => 'Only active roles',                       Active  => 'Only active roles',
                      Expired => 'Only past roles',                       Expired => 'Only past roles',
                      Future  => 'Only future roles',                       Future  => 'Only future roles',
                    );                     );
       }
 }  }
       
 sub handler {  sub handler {
Line 3852  ENDREDIR Line 3896  ENDREDIR
     $env{'user.domain'},      $env{'user.domain'},
     'CourseBlog_'.$env{'request.course.id'},      'CourseBlog_'.$env{'request.course.id'},
     $subject,$message,$feedurl,'public');      $subject,$message,$feedurl,'public');
   $blog='<br />'.&mt('Added to my course blog').'<br />';            if (&Apache::loncommon::course_type() eq 'Community') {
                 $blog='<br />'.&mt('Added to my community blog').'<br />';
             } else {
         $blog='<br />'.&mt('Added to my course blog').'<br />';
             }
       }        }
       
 # Receipt screen and redirect back to where came from  # Receipt screen and redirect back to where came from

Removed from v.1.277  
changed lines
  Added in v.1.278


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