Diff for /loncom/interface/lonfeedback.pm between versions 1.157 and 1.163

version 1.157, 2005/04/07 06:56:23 version 1.163, 2005/05/20 17:04:30
Line 2375  sub secapply { Line 2375  sub secapply {
     return '';      return '';
 }  }
   
   =pod 
   
   =over 4
   
   =item *
   
   decide_receiver($feedurl,$author,$question,$course,$policy,$defaultflag);
   
   Arguments
     $feedurl - /res/ url of resource (only need if $author is true)
     $author,$question,$course,$policy - all true/false parameters
       if true will attempt to find the addresses of user that should receive
       this type of feedback (author - feedback to author of resource $feedurl,
       $question 'Resource Content Questions', $course 'Course Content Question',
       $policy 'Course Policy')
       (Additionally it also checks $env for whether the corresponding form.<name>
       element exists, for ease of use in a html response context)
      
     $defaultflag - (internal should be left blank) if true gather addresses 
                    that aren't for a section even if I have a section
                    (used for reccursion internally, first we look for
                    addresses for our specific section then we recurse
                    and look for non section addresses)
   
   Returns
     $typestyle - string of html text, describing what addresses were found
     %to - a hash, which keys are addresses of users to send messages to
           the keys will look like   name:domain
   
   =cut
   
 sub decide_receiver {  sub decide_receiver {
   my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_;    my ($feedurl,$author,$question,$course,$policy,$defaultflag) = @_;
   my $typestyle='';    my $typestyle='';
   my %to=();    my %to=();
   if ($env{'form.author'}||$author) {    if ($env{'form.author'}||$author) {
     $typestyle.='Submitting as Author Feedback<br>';      $typestyle.='Submitting as Author Feedback<br />';
     $feedurl=~/^\/res\/(\w+)\/(\w+)\//;      $feedurl=~/^\/res\/(\w+)\/(\w+)\//;
     $to{$2.':'.$1}=1;      $to{$2.':'.$1}=1;
   }    }
   if ($env{'form.question'}||$question) {    if ($env{'form.question'}||$question) {
     $typestyle.='Submitting as Question<br>';      $typestyle.='Submitting as Question<br />';
     foreach (split(/\,/,      foreach (split(/\,/,
    $env{'course.'.$env{'request.course.id'}.'.question.email'})     $env{'course.'.$env{'request.course.id'}.'.question.email'})
      ) {       ) {
Line 2686  END Line 2717  END
   
 sub process_attachments {  sub process_attachments {
     my ($currnewattach,$currdelold,$keepold) = @_;      my ($currnewattach,$currdelold,$keepold) = @_;
     if (exists($env{'form.currnewattach'})) {  
         if (ref($env{'form.currnewattach'}) eq 'ARRAY') {      @{$currnewattach}=
             @{$currnewattach} = @{$env{'form.currnewattach'}};   &Apache::loncommon::get_env_multiple('form.currnewattach');
         } else {      @{$currdelold}=
             $$currnewattach[0] = $env{'form.currnewattach'};   &Apache::loncommon::get_env_multiple('form.deloldattach');
         }  
     }  
     if (exists($env{'form.deloldattach'})) {  
         if (ref($env{'form.deloldattach'}) eq 'ARRAY') {  
             @{$currdelold} = @{$env{'form.deloldattach'}};  
         } else {  
             $$currdelold[0] = $env{'form.deloldattach'};  
         }  
     }  
     if (exists($env{'form.delnewattach'})) {      if (exists($env{'form.delnewattach'})) {
         my @currdelnew = ();          my @currdelnew =
       &Apache::loncommon::get_env_multiple('form.delnewattach');
         my @currnew = ();          my @currnew = ();
         if (ref($env{'form.delnewattach'}) eq 'ARRAY') {  
             @currdelnew = @{$env{'form.delnewattach'}};  
         } else {  
             $currdelnew[0] = $env{'form.delnewattach'};  
         }  
         foreach my $newone (@{$currnewattach}) {          foreach my $newone (@{$currnewattach}) {
             my $delflag = 0;              my $delflag = 0;
             foreach (@currdelnew) {              foreach (@currdelnew) {
Line 2722  sub process_attachments { Line 2740  sub process_attachments {
         }          }
         @{$currnewattach} = @currnew;          @{$currnewattach} = @currnew;
     }      }
     if (exists($env{'form.keepold'})) {      @{$keepold} = &Apache::loncommon::get_env_multiple('form.keepold');
         if (ref($env{'form.keepold'}) eq 'ARRAY') {  
             @{$keepold} = @{$env{'form.keepold'}};  
         } else {  
             $$keepold[0] = $env{'form.keepold'};  
         }  
     }  
 }  }
   
 sub generate_attachments_button {  sub generate_attachments_button {
Line 2885  sub has_discussion { Line 2897  sub has_discussion {
     my @allres=$navmap->retrieveResources();      my @allres=$navmap->retrieveResources();
     foreach my $resource (@allres) {      foreach my $resource (@allres) {
         if ($resource->hasDiscussion()) {          if ($resource->hasDiscussion()) {
             my $ressymb;              my $ressymb = $resource->wrap_symb();
             if ($resource->symb() =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) {  
                 $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard';  
             } else {  
                 $ressymb = $resource->symb();  
             }  
             push @{$resourcesref}, $ressymb;              push @{$resourcesref}, $ressymb;
         }          }
     }      }
Line 3049  END Line 3056  END
           'twnp' => 'There are currently no resources or bulletin boards with unread discussion postings.'            'twnp' => 'There are currently no resources or bulletin boards with unread discussion postings.'
       );               );       
       foreach (@resources) {        foreach (@resources) {
 # backward compatibility (bulletin boards used to be 'wrapped')  
           my $ressymb=$_;            my $ressymb=$_;
   &Apache::lonenc::check_decrypt(\$ressymb);    &Apache::lonenc::check_decrypt(\$ressymb);
           if ($ressymb =~ m/bulletin___\d+___/) {  
               unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) {  
                   $ressymb=~s|(bulletin___\d+___)|$1adm/wrapper/|;  
               }  
           }  
           my $lastkey = $ressymb.'_lastread';            my $lastkey = $ressymb.'_lastread';
           $discinfo{$lastkey} = $env{'form.navtime'};            $discinfo{$lastkey} = $env{'form.navtime'};
       }        }
Line 3277  ENDREDIR Line 3278  ENDREDIR
   unless ($symb) { $goahead=0; }    unless ($symb) { $goahead=0; }
       }        }
       # backward compatibility (bulletin boards used to be 'wrapped')        # backward compatibility (bulletin boards used to be 'wrapped')
       if ($feedurl=~m|^/adm/wrapper/adm/.*/bulletinboard$|) {        &dewrapper(\$feedurl);
   $feedurl=~s|^/adm/wrapper||;  
       }  
       if (!$goahead) {        if (!$goahead) {
           # Ambiguous Problem Resource            # Ambiguous Problem Resource
   $r->internal_redirect('/adm/ambiguous');    $r->internal_redirect('/adm/ambiguous');

Removed from v.1.157  
changed lines
  Added in v.1.163


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