Diff for /loncom/interface/lonfeedback.pm between versions 1.273.4.3 and 1.275

version 1.273.4.3, 2010/01/24 03:13:55 version 1.275, 2009/07/09 12:53:28
Line 91  sub list_discussion { Line 91  sub list_discussion {
     if (not &discussion_visible($status)) {      if (not &discussion_visible($status)) {
         if ($mode ne 'board') {          if ($mode ne 'board') {
             &Apache::lonenc::check_encrypt(\$ressymb);               &Apache::lonenc::check_encrypt(\$ressymb); 
             return '<br />'.&send_message_link($ressymb);              return '<br /><div class="LC_feedback_link">'.&send_message_link($ressymb)."</div>";
         }          }
     }      }
     if ($group ne '' && $mode eq 'board') {      if ($group ne '' && $mode eq 'board') {
Line 103  sub list_discussion { Line 103  sub list_discussion {
     my ($blocked,$blocktext) =       my ($blocked,$blocktext) = 
         &Apache::loncommon::blocking_status('boards');          &Apache::loncommon::blocking_status('boards');
     if ($blocked) {      if ($blocked) {
           $blocktext = '<br /><div class="LC_feedback_link"><span class="LC_feedback_link">'.$blocktext."</span>";
         &Apache::lonenc::check_encrypt(\$ressymb);          &Apache::lonenc::check_encrypt(\$ressymb);
         if ($mode ne 'board') {          if ($mode ne 'board') {
             $blocktext.='<br />'.&send_message_link($ressymb);              $blocktext.=&send_message_link($ressymb).'</div>';
           }else{
               $blocktext.="</div>";
         }          }
         return $blocktext;           return $blocktext; 
     }      }
Line 169  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 599  END Line 600  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,$crstype);                  &sort_filter_names(\%sort_types,\%role_types,\%status_types);
   
                 $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 725  END Line 726  END
  &postingform_display($mode,$ressymb,$now,$subject,   &postingform_display($mode,$ressymb,$now,$subject,
      $comment,$outputtarget,$attachnum,       $comment,$outputtarget,$attachnum,
      $currnewattach,$currdelold,       $currnewattach,$currdelold,
      $group,$crstype);       $group);
                 }                  }
             } else {              } else {
         $discussion.=           $discussion.= 
     &postingform_display($mode,$ressymb,$now,$subject,      &postingform_display($mode,$ressymb,$now,$subject,
  $comment,$outputtarget,$attachnum,   $comment,$outputtarget,$attachnum,
  $currnewattach,$currdelold,'',$crstype);   $currnewattach,$currdelold);
             }              }
  }   }
     } else {      } else {
Line 757  sub send_feedback_link { Line 758  sub send_feedback_link {
     my $output = '<span class="LC_feedback_link">'.      my $output = '<span class="LC_feedback_link">'.
                  ' <a href="/adm/feedback?replydisc='.                   ' <a href="/adm/feedback?replydisc='.
                  &escape($ressymb).':::" '.$target.'>'.                   &escape($ressymb).':::" '.$target.'>'.
                  '<img alt="" src="'.                   '<img alt="" class="LC_noBorder" src="'.
                  &Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').                   &Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').
                  '" border="0" />'.&mt('Post Discussion').'</a></span>';                   '" border="0" /><span class="LC_menubuttons_inline_text">'.&mt('Post Discussion').'</span></a></span>';
     return $output;      return $output;
 }  }
   
Line 767  sub send_message_link { Line 768  sub send_message_link {
     my ($ressymb) = @_;      my ($ressymb) = @_;
     my $output = '<span class="LC_message_link">'.      my $output = '<span class="LC_message_link">'.
                  '  <a href="/adm/feedback?sendmessageonly=1&amp;symb='.                   '  <a href="/adm/feedback?sendmessageonly=1&amp;symb='.
                  &escape($ressymb).'"><img alt="" src="'.                   &escape($ressymb).'"><img alt="" class="LC_noBorder" src="'.
                  &Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').                   &Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').
                  '" border="0" />'.&mt('Send Feedback').'</a></span>';                   '" border="0" /><span class="LC_menubuttons_inline_text">'.&mt('Send Feedback').'</span></a></span>';
     return $output;      return $output;
 }  }
   
 sub action_links_bar {  sub action_links_bar {
     my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_;      my ($colspan,$ressymb,$visible,$newpostsflag,$group,$prevread,$markondisp) = @_;
     my $discussion = '<tr><td class="LC_disc_action_links_bar" colspan="'.$colspan.'">'.      my $discussion = '<tr><td class="LC_disc_action_links_bar" colspan="'.$colspan.'">'.
                      '<table width="100%" class="LC_disc_action_table"><tr>'.                       '<table width="100%" class="LC_disc_action_table"><tr>';
                      '<td class="LC_disc_action_left">';  
     my $escsymb=&escape($ressymb);      my $escsymb=&escape($ressymb);
     if ($visible>2) {      if ($visible>2) {
         $discussion .= '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;          $discussion .= '<td class="LC_disc_action_left">'.
                          '<a href="/adm/feedback?cmd=threadedon&amp;symb='.$escsymb;
         if ($newpostsflag) {          if ($newpostsflag) {
             $discussion .= '&previous='.$prevread;              $discussion .= '&previous='.$prevread;
         }          }
Line 798  sub action_links_bar { Line 799  sub action_links_bar {
         }          }
         $discussion .= &group_args($group);          $discussion .= &group_args($group);
         $discussion .='">'.&mt('Sorting/Filtering options').'</a>'.('&nbsp;' x2);          $discussion .='">'.&mt('Sorting/Filtering options').'</a>'.('&nbsp;' x2);
       } else {
           $discussion .= '<td class="LC_disc_action_left>';
     }      }
     $discussion .='<a href="/adm/feedback?export='.$escsymb;      $discussion .='<a href="/adm/feedback?export='.$escsymb;
     if ($newpostsflag) {      if ($newpostsflag) {
Line 826  sub action_links_bar { Line 829  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,$crstype) = @_;          $currnewattach,$currdelold,$group) = @_;
     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 835  sub postingform_display { Line 838  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 865  ENDDISCUSS Line 865  ENDDISCUSS
     }      }
     my $blockblog = &Apache::loncommon::blocking_status('blogs');      my $blockblog = &Apache::loncommon::blocking_status('blogs');
     if (!$blockblog) {      if (!$blockblog) {
         $postingform .= &add_blog_checkbox($crstype);          $postingform .= &add_blog_checkbox();
     }      }
     $postingform .= "</form>\n";      $postingform .= "</form>\n";
     if ($outputtarget ne 'tex') {      if ($outputtarget ne 'tex') {
Line 1482  sub mail_screen { Line 1482  sub mail_screen {
   }    }
   
   my %lt = &Apache::lonlocal::texthash(    my %lt = &Apache::lonlocal::texthash(
               'plch' => 'Please check at least one of the following feedback types:',
             'myqu' => 'My question/comment/feedback:',              'myqu' => 'My question/comment/feedback:',
             'title' => 'Title',              'title' => 'Title',
             'reta' => 'Retained attachments',              'reta' => 'Retained attachments',
Line 1692  END Line 1693  END
 END  END
   }    }
   $r->print(<<END);    $r->print(<<END);
   $lt{'plch'}
 $options<hr />  $options<hr />
 $quote  $quote
 <p>$lt{'myqu'}</p>  <p>$lt{'myqu'}</p>
Line 2007  sub print_sortfilter_options { Line 2009  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'});
Line 2077  sub print_sortfilter_options { Line 2072  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,$crstype);      &sort_filter_names(\%sort_types,\%role_types,\%status_types);
   
     my $js = <<END;      my $js = <<END;
 <script type="text/javascript">  <script type="text/javascript">
Line 2166  $start_page Line 2161  $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="$ccrole">$role_types{$ccrole}</option>      <option value="cc">$role_types{'cc'}</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 2570  ENDNOREDIRTWO Line 2564  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 2606  sub screen_header { Line 2584  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'}:$crscontent).   ($optionhash{'comment'}?$optionhash{'comment'}:&mt('Question/Comment/Feedback about course content')).
  '</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'}:$crspolicy).   ($optionhash{'policy'}?$optionhash{'policy'}:&mt('Question/Comment/Feedback about course policy')).
  '</label></p>';   '</label></p>';
  }   }
     }      }
Line 2623  sub screen_header { Line 2601  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" /> '.
                 $contribdisc.   &mt('Contribution to course discussion of resource');
                 '</label><br /><label><input type="radio" name="discuss" value="anon" /> '.          $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
                 $anoncontrib.   &mt('Anonymous contribution to course discussion of resource').
                 ' <i>('.$namevis.')</i></label> '.   ' <i>('.&mt('name only visible to course faculty').')</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($crstype);                  $discussoptions.= &add_blog_checkbox();
             }              }
         }          }
     }      }
     if ($msgoptions) {      if ($msgoptions) {
         $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').'" />'          $msgoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/com.png').'" />'
                    .' '.&mt('Send Feedback').'</h2><p>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Feedback Settings'),'feedback').'</p>'                     .' '.&mt('Send Feedback').'</h2>'
                    .$msgoptions;                     .$msgoptions;
     }      }
     if ($discussoptions) {       if ($discussoptions) { 
  $discussoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" />'   $discussoptions='<h2><img src="'.&Apache::loncommon::lonhttpdurl('/adm/lonMisc/chat.gif').'" />'
                         .' '.&mt('Discussion Contributions').'</h2><p>'.&Apache::lonhtmlcommon::coursepreflink(&mt('Discussion Settings'),'discussion').'</p>'                          .' '.&mt('Discussion Contributions').'</h2>'
                         .$discussoptions;                          .$discussoptions;
     }      }
     return $msgoptions.$discussoptions;      return $msgoptions.$discussoptions;
Line 3271  sub construct_attachmenturl { Line 3248  sub construct_attachmenturl {
 }  }
   
 sub add_blog_checkbox {  sub add_blog_checkbox {
     my ($crstype) = @_;      my ($checkstatus);
     my $checkstatus;  
     if ($env{'form.blog'}) {      if ($env{'form.blog'}) {
         $checkstatus = 'checked="checked"';          $checkstatus = 'checked="checked"';
     }      }
Line 3286  function setblogvalue() { Line 3262  function setblogvalue() {
     }      }
 }  }
 </script><br />  </script><br />
 <label><input type="checkbox" name="blog" '.$checkstatus.' /> ';  <label><input type="checkbox" name="blog" '.$checkstatus.' /> '.
     if ($crstype eq 'Community') {  &mt('Add to my public course blog').'</label><br />'."\n";
         $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 3316  sub has_discussion { Line 3287  sub has_discussion {
 }  }
   
 sub sort_filter_names {  sub sort_filter_names {
     my ($sort_types,$role_types,$status_types,$crstype) = @_;      my ($sort_types,$role_types,$status_types) = @_;
     if (ref($sort_types) eq 'HASH') {      %{$sort_types} = (
         %{$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 3326  sub sort_filter_names { Line 3296  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} = (
     my @courseroles = qw(st in ta ep ad);                       all => 'All roles',
     if ($crstype eq 'Community') {                       st  => 'Students',
         push(@courseroles,'co');                       cc  => 'Course Coordinators',
     } else {                       in  => 'Instructors',
         push(@courseroles,'cc');                       ta  => 'TAs',
     }                       ep  => 'Exam proctors',
     if (ref($role_types) eq 'HASH') {                       ad  => 'Administrators',
         foreach my $role (@courseroles) {                       cr  => 'Custom roles'
             $role_types->{$role} = &Apache::lonnet::plaintext($role,$crstype);                     );
         }      %{$status_types} = (
         $role_types->{'all'} = 'All roles';                       all     => 'Roles of any status',
         $role_types->{'cr'} = 'Custom role';                       Active  => 'Only active roles',
     }                       Expired => 'Only past roles',
     if (ref($status_types) eq 'HASH') {                       Future  => 'Only future roles',
         %{$status_types} = (                     );
                       all     => 'Roles of any status',  
                       Active  => 'Only active roles',  
                       Expired => 'Only past roles',  
                       Future  => 'Only future roles',  
                     );  
     }  
 }  }
     
 sub handler {  sub handler {
   my $r = shift;    my $r = shift;
   if ($r->header_only) {    if ($r->header_only) {
Line 3875  ENDREDIR Line 3839  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');
           if (&Apache::loncommon::course_type() eq 'Community') {    $blog='<br />'.&mt('Added to my course blog').'<br />';
               $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.273.4.3  
changed lines
  Added in v.1.275


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