Diff for /loncom/interface/lonfeedback.pm between versions 1.143 and 1.144

version 1.143, 2004/11/20 20:40:51 version 1.144, 2004/11/21 04:24:49
Line 151  sub list_discussion { Line 151  sub list_discussion {
         %roleshash = &Apache::lonnet::dump('nohist_userroles',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},$ENV{'course.'.$ENV{'request.course.id'}.'.num'});          %roleshash = &Apache::lonnet::dump('nohist_userroles',$ENV{'course.'.$ENV{'request.course.id'}.'.domain'},$ENV{'course.'.$ENV{'request.course.id'}.'.num'});
         foreach (keys %roleshash) {          foreach (keys %roleshash) {
             my ($role,$uname,$udom,$sec) = split/:/,$_;              my ($role,$uname,$udom,$sec) = split/:/,$_;
               if ($role =~ /^cr/) {
                   $role = 'cr';
               }
             my ($end,$start) = split/:/,$roleshash{$_};              my ($end,$start) = split/:/,$roleshash{$_};
             my $now = time;              my $now = time;
             my $status = 'Active';              my $status = 'Active';
             if (($now < $start) || ($end > 0 && $now > $end)) {              if (($now < $start) || ($end > 0 && $now > $end)) {
                 $status = 'Expired';                  $status = 'Expired';
             }              }
             push @{$roleinfo{$uname.':'.$udom}}, $role.':'.$sec.':'.$status;              if ($uname && $udom) { 
                   push @{$roleinfo{$uname.':'.$udom}}, $role.':'.$sec.':'.$status;
               }
         }          }
         my ($classlist) = &Apache::loncoursedata::get_classlist(          my ($classlist) = &Apache::loncoursedata::get_classlist(
                               $ENV{'request.course.id'},                                $ENV{'request.course.id'},
Line 446  imscp_v1p1.xsd http://www.imsglobal.org/ Line 451  imscp_v1p1.xsd http://www.imsglobal.org/
                  }                   }
             }              }
         } else {          } else {
             $sortposts = 'ascdate';  
             @showposts =  (sort { $a <=> $b } keys %alldiscussion);              @showposts =  (sort { $a <=> $b } keys %alldiscussion);
         }          }
         my $currdepth = 0;          my $currdepth = 0;
         my $firstidx = $alldiscussion{$showposts[0]};          my $firstidx = $alldiscussion{$showposts[0]};
         foreach (@showposts) {          foreach (@showposts) {
             unless (($sortposts eq 'thread') || ($sortposts eq 'ascdate' && $ENV{'environment.threadeddiscussion'}) || ($outputtarget eq 'export')) {              unless (($sortposts eq 'thread') || (($sortposts eq '') && ($ENV{'environment.threadeddiscussion'})) || ($outputtarget eq 'export')) {
                 $alldiscussion{$_} = $_;                  $alldiscussion{$_} = $_;
             }              }
             unless ( ($notshown{$alldiscussion{$_}} eq '1') || ($shown{$alldiscussion{$_}} == 0) ) {              unless ( ($notshown{$alldiscussion{$_}} eq '1') || ($shown{$alldiscussion{$_}} == 0) ) {
Line 550  END Line 554  END
             $discussion .= <<END;              $discussion .= <<END;
                    </font></td>                     </font></td>
                    <td>&nbsp;</td>                     <td>&nbsp;</td>
                    <td>                     <td align="left">
                     <font size="-1"><b><a href="$chglink">$lt{'chgt'}</a>?</font></b>                      <font size="-1"><b><a href="$chglink">$lt{'chgt'}</a>?</font></b>
                    </td>                     </td>
                   </tr>                    </tr>
Line 565  END Line 569  END
   
                 $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'})) {
                     $discussion .= &mt('Posts by').': ';                      $discussion .= &mt('Posts by').':';
                     if ($totposters > 0) {                      if ($totposters > 0) {
                         foreach my $poster (@posters) {                          foreach my $poster (@posters) {
                             $poster =~ s/:/\@/;                              $poster =~ s/:/\@/;
                             $discussion .= $poster.',';                              $discussion .= ' '.$poster.',';
                         }                          }
                         $discussion =~ s/,//;                          $discussion =~ s/,$//;
                     } else {                      } else {
                         $discussion .= &mt('None selected');                          $discussion .= &mt('None selected');
                     }                      }
Line 582  END Line 586  END
                         $filterchoice .= '&nbsp;&nbsp;&nbsp; ';                          $filterchoice .= '&nbsp;&nbsp;&nbsp; ';
                     }                      }
                     if (@rolefilter > 0) {                      if (@rolefilter > 0) {
                         $filterchoice .= '<i>'.&mt('roles').'</i>-&nbsp;';                          $filterchoice .= '<i>'.&mt('roles').'</i>-';
                         foreach (@rolefilter) {                          foreach (@rolefilter) {
                             $filterchoice .= $role_types{$_}.',&nbsp;';                              $filterchoice .= '&nbsp;'.$role_types{$_}.',';
                         }                          }
                         $filterchoice .= '&nbsp;&nbsp;&nbsp; ';                          $filterchoice =~ s/,$//;
                           $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 763  sub build_posting_display { Line 768  sub build_posting_display {
     my $origindex='0.';      my $origindex='0.';
             my $numoldver=0;              my $numoldver=0;
     if ($contrib{$idx.':replyto'}) {      if ($contrib{$idx.':replyto'}) {
                 if ( (($ENV{'environment.threadeddiscussion'}) && (($sortposts eq '') || ($sortposts eq 'ascdate'))) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) {                  if ( (($ENV{'environment.threadeddiscussion'}) && ($sortposts eq '')) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) {
 # this is a follow-up message  # this is a follow-up message
     $original[$idx]=$original[$contrib{$idx.':replyto'}];      $original[$idx]=$original[$contrib{$idx.':replyto'}];
     $$depth[$idx]=$$depth[$contrib{$idx.':replyto'}]+1;      $$depth[$idx]=$$depth[$contrib{$idx.':replyto'}]+1;
Line 958  sub build_posting_display { Line 963  sub build_posting_display {
                 }                  }
                 if ($outputtarget eq 'export' || $message) {                  if ($outputtarget eq 'export' || $message) {
     my $thisindex=$idx;      my $thisindex=$idx;
     if ( (($ENV{'environment.threadeddiscussion'}) && (($sortposts eq '') || ($sortposts eq 'ascdate'))) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) {      if ( (($ENV{'environment.threadeddiscussion'}) && ($sortposts eq '')) || ($sortposts eq 'thread') || ($outputtarget eq 'export')) {
  $thisindex=$origindex.substr('00'.$$replies[$$depth[$idx]],-2,2);   $thisindex=$origindex.substr('00'.$$replies[$$depth[$idx]],-2,2);
     }      }
     $$alldiscussion{$thisindex}=$idx;      $$alldiscussion{$thisindex}=$idx;
Line 1016  sub build_posting_display { Line 1021  sub build_posting_display {
                                             my $cc_regexp = $roleregexp.':[^:]*:'.$statusregexp;                                              my $cc_regexp = $roleregexp.':[^:]*:'.$statusregexp;
                                             if ($role =~ /$cc_regexp/) {                                              if ($role =~ /$cc_regexp/) {
                                                 $$shown{$idx} = 1;                                                  $$shown{$idx} = 1;
                                                   last;
                                             }                                              }
                                         } elsif ($role =~ /^$rolematch$/) {                                          } elsif ($role =~ /^$rolematch$/) {
                                             $$shown{$idx} = 1;                                              $$shown{$idx} = 1;
Line 1776  sub print_sortfilter_options { Line 1782  sub print_sortfilter_options {
     my $section_sel = '';      my $section_sel = '';
     my $numsections = 0;      my $numsections = 0;
     my $numvisible = 5;      my $numvisible = 5;
     my ($classlist) = &Apache::loncoursedata::get_classlist(  
                               $ENV{'request.course.id'},  
                               $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},  
                               $ENV{'course.'.$ENV{'request.course.id'}.'.num'});  
                                                                                      
     my $sec_index = &Apache::loncoursedata::CL_SECTION();  
     my $status_index = &Apache::loncoursedata::CL_STATUS();  
     my %sectioncount = ();      my %sectioncount = ();
     while (my ($student,$data) = each %$classlist) {  
         my ($section,$status) = ($data->[$sec_index],      $numsections = &Apache::loncommon::get_sections($ENV{'course.'.$ENV{'request.course.id'}.'.domain'},$ENV{'course.'.$ENV{'request.course.id'}.'.num'},\%sectioncount);
                                  $data->[$status_index]);  
         unless ($section eq '' || $section =~ /^\s*$/) {      if ($ENV{'request.course.sec'} !~ /^\s*$/) {  #Restrict section choice to current section 
             if (!defined($sectioncount{$section})) {          @sections = ('all',$ENV{'request.course.sec'});
                 $sectioncount{$section} = 1;          $numvisible = 2;
                 $numsections ++;  
             } else {  
                 $sectioncount{$section} ++;  
             }  
         }  
     }  
                                                                                      
     if ($ENV{'request.course.sec'} !~ /^\s*$/) {  
         @sections = ($ENV{'request.course.sec'});  
         $numvisible = 1;  
     } else {      } else {
         @sections = sort {$a cmp $b} keys(%sectioncount);          @sections = sort {$a cmp $b} keys(%sectioncount);
         unshift(@sections,'all'); # Put 'all' at the front of the list          unshift(@sections,'all'); # Put 'all' at the front of the list
Line 1840  sub print_sortfilter_options { Line 1829  sub print_sortfilter_options {
 <head>  <head>
 <title>$lt{'diso'}</title>  <title>$lt{'diso'}</title>
 <meta http-equiv="pragma" content="no-cache" />  <meta http-equiv="pragma" content="no-cache" />
   <script type="text/javascript">
   function verifyFilter() {
       var rolenum = 0
       for (var i=0; i<document.modifyshown.rolefilter.length; i++) {
           if (document.modifyshown.rolefilter.options[i].selected == true) {
               rolenum ++
           }
       }
       if (rolenum == 0) {
           document.modifyshown.rolefilter.options[0].selected = true
       }
   
       var secnum = 0
       for (var i=0; i<document.modifyshown.sectionpick.length; i++) {
           if (document.modifyshown.sectionpick.options[i].selected == true) {
               secnum ++
           }
       }
       if (secnum == 0) {
           document.modifyshown.sectionpick.options[0].selected = true
       }
       document.modifyshown.submit();
   }
   </script>
 </head>  </head>
 $bodytag  $bodytag
 <form name="modifyshown" method="post" action="/adm/feedback">  <form name="modifyshown" method="post" action="/adm/feedback">
Line 1860  $bodytag Line 1873  $bodytag
  <tr>   <tr>
   <td align="center">    <td align="center">
    <select name="sortposts">     <select name="sortposts">
     <option value="ascdate" />$sort_types{'ascdate'}      <option value="ascdate" selected="selected" />$sort_types{'ascdate'}
     <option value="descdate" />$sort_types{'descdate'}      <option value="descdate" />$sort_types{'descdate'}
     <option value="thread" />$sort_types{'thread'}      <option value="thread" />$sort_types{'thread'}
     <option value="subject" />$sort_types{'subject'}      <option value="subject" />$sort_types{'subject'}
Line 1871  $bodytag Line 1884  $bodytag
   <td>&nbsp;</td>    <td>&nbsp;</td>
   <td align="center">    <td align="center">
    <select name="statusfilter">     <select name="statusfilter">
     <option value="all" />$status_types{'all'}      <option value="all" selected="selected" />$status_types{'all'}
     <option value="Active" />$status_types{'Active'}      <option value="Active" />$status_types{'Active'}
     <option value="Expired" />$status_types{'Expired'}      <option value="Expired" />$status_types{'Expired'}
    </select>     </select>
Line 1903  $bodytag Line 1916  $bodytag
 <br />  <br />
 <input type="hidden" name="previous" value="$previous" />  <input type="hidden" name="previous" value="$previous" />
 <input type="hidden" name="applysort" value="$symb" />  <input type="hidden" name="applysort" value="$symb" />
 <input type="button" name="sub" value="Store Changes" onClick="javascript:document.modifyshown.submit()" />  <input type="button" name="sub" value="Store Changes" onClick="verifyFilter()" />
 <br />  <br />
 <br />  <br />
 </form>  </form>

Removed from v.1.143  
changed lines
  Added in v.1.144


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