Diff for /loncom/interface/lonmsg.pm between versions 1.93 and 1.100

version 1.93, 2004/03/26 16:57:53 version 1.100, 2004/05/10 22:39:51
Line 101  use Apache::lontexconvert(); Line 101  use Apache::lontexconvert();
 use HTML::Entities();  use HTML::Entities();
 use Mail::Send;  use Mail::Send;
 use Apache::lonlocal;  use Apache::lonlocal;
   use Apache::loncommunicate;
   
 # Querystring component with sorting type  # Querystring component with sorting type
 my $sqs;  my $sqs;
Line 109  my $sqs; Line 110  my $sqs;
   
 sub packagemsg {  sub packagemsg {
     my ($subject,$message,$citation,$baseurl,$attachmenturl)=@_;      my ($subject,$message,$citation,$baseurl,$attachmenturl)=@_;
     $message =&HTML::Entities::encode($message);      $message =&HTML::Entities::encode($message,'<>&"');
     $citation=&HTML::Entities::encode($citation);      $citation=&HTML::Entities::encode($citation,'<>&"');
     $subject =&HTML::Entities::encode($subject);      $subject =&HTML::Entities::encode($subject,'<>&"');
     #remove machine specification      #remove machine specification
     $baseurl =~ s|^http://[^/]+/|/|;      $baseurl =~ s|^http://[^/]+/|/|;
     $baseurl =&HTML::Entities::encode($baseurl);      $baseurl =&HTML::Entities::encode($baseurl,'<>&"');
     #remove machine specification      #remove machine specification
     $attachmenturl =~ s|^http://[^/]+/|/|;      $attachmenturl =~ s|^http://[^/]+/|/|;
     $attachmenturl =&HTML::Entities::encode($attachmenturl);      $attachmenturl =&HTML::Entities::encode($attachmenturl,'<>&"');
   
     my $now=time;      my $now=time;
     $msgcount++;      $msgcount++;
Line 171  sub unpackagemsg { Line 172  sub unpackagemsg {
        }         }
     }      }
     if ($content{'attachmenturl'}) {      if ($content{'attachmenturl'}) {
        my ($fname,$ft)=($content{'attachmenturl'}=~/\/(\w+)\.(\w+)$/);         my ($fname)=($content{'attachmenturl'}=~m|/([^/]+)$|);
        if ($notoken) {         if ($notoken) {
    $content{'message'}.='<p>'.&mt('Attachment').': <tt>'.$fname.'.'.$ft.'</tt>';     $content{'message'}.='<p>'.&mt('Attachment').': <tt>'.$fname.'</tt>';
        } else {         } else {
    $content{'message'}.='<p>'.&mt('Attachment').': <a href="'.     &Apache::lonnet::allowuploaded('/adm/msg',
        &Apache::lonnet::tokenwrapper($content{'attachmenturl'}).    $content{'attachmenturl'});
        '"><tt>'.$fname.'.'.$ft.'</tt></a>';     $content{'message'}.='<p>'.&mt('Attachment').
          ': <a href="'.$content{'attachmenturl'}.'"><tt>'.
          $fname.'</tt></a>';
        }         }
     }      }
     return %content;      return %content;
Line 204  sub sendemail { Line 207  sub sendemail {
     my $msg = new Mail::Send;      my $msg = new Mail::Send;
     $msg->to($to);      $msg->to($to);
     $msg->subject('[LON-CAPA] '.$subject);      $msg->subject('[LON-CAPA] '.$subject);
     if (my $fh = $msg->open('smtp',Server => 'localhost')) {      if (my $fh = $msg->open()) {
  print $fh $body;   print $fh $body;
  $fh->close;   $fh->close;
     }      }
Line 756  ENDDISHEADER Line 759  ENDDISHEADER
 # ============================================================== Compose output  # ============================================================== Compose output
   
 sub compout {  sub compout {
     my ($r,$forwarding,$replying,$broadcast)=@_;      my ($r,$forwarding,$replying,$broadcast,$replycrit)=@_;
   
     if ($broadcast eq 'individual') {      if ($broadcast eq 'individual') {
  &printheader($r,'/adm/email?compose=individual',   &printheader($r,'/adm/email?compose=individual',
Line 776  sub compout { Line 779  sub compout {
           text=>"Display Message"});            text=>"Display Message"});
  &printheader($r,'/adm/email?replyto='.&Apache::lonnet::escape($replying),   &printheader($r,'/adm/email?replyto='.&Apache::lonnet::escape($replying),
      'Replying to a Message');       'Replying to a Message');
       } elsif ($replycrit) {
    $r->print('<h3>'.&mt('Replying to a Critical Message').'</h3>');
    $replying=$replycrit;
     } else {      } else {
  &printheader($r,'/adm/email?compose=upload',   &printheader($r,'/adm/email?compose=upload',
      'Distribute from Uploaded File');       'Distribute from Uploaded File');
Line 907  ENDUPLOAD Line 913  ENDUPLOAD
   
 sub disfacetoface {  sub disfacetoface {
     my ($r,$user,$domain)=@_;      my ($r,$user,$domain)=@_;
       my $target=$ENV{'form.grade_target'};
     unless ($ENV{'request.course.id'}) { return; }      unless ($ENV{'request.course.id'}) { return; }
     unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {      unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
  return;   return;
Line 940  $content{'sendername'}.'@'. Line 947  $content{'sendername'}.'@'.
      }       }
     # Check to see if there were any messages.      # Check to see if there were any messages.
     if ($result eq '') {      if ($result eq '') {
         $r->print("<p><b>".&mt("No notes, face-to-face discussion records, or critical messages in this course.")."</b></p>");   if ($target ne 'tex') { 
       $r->print("<p><b>".&mt("No notes, face-to-face discussion records, or critical messages in this course.")."</b></p>");
    } else {
       $r->print('\textbf{'.&mt("No notes, face-to-face discussion records, or critical messages in this course.").'}\\\\');
    }
     } else {      } else {
        $r->print($result);         $r->print($result);
     }      }
Line 1151  sub handler { Line 1162  sub handler {
  my $msgid=$1;   my $msgid=$1;
  $r->print('<b>'.&mt('Confirming Receipt').':</b> '.   $r->print('<b>'.&mt('Confirming Receipt').':</b> '.
   &user_crit_received($msgid).'<br>');    &user_crit_received($msgid).'<br>');
  &compout($r,'',$msgid);   &compout($r,'','','',$msgid);
     }      }
  }   }
  &discrit($r);   &discrit($r);
Line 1246  sub handler { Line 1257  sub handler {
  $r->print($thismsg.'<br />');   $r->print($thismsg.'<br />');
  $sendstatus.=' '.$thismsg;   $sendstatus.=' '.$thismsg;
     }      }
    } else {
       &printheader($r,'','No messages sent.'); 
  }   }
  if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {   if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {
     $r->print('<br /><font color="green">'.&mt('Completed.').'</font>');      $r->print('<br /><font color="green">'.&mt('Completed.').'</font>');
     if ($ENV{'form.displayedcrit'}) {      if ($ENV{'form.displayedcrit'}) {
  &discrit($r);   &discrit($r);
     } else {      } else {
  &disall($r);   &Apache::loncommunicate::menu($r);
     }      }
  } else {   } else {
     $r->print(      $r->print(

Removed from v.1.93  
changed lines
  Added in v.1.100


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