Diff for /loncom/interface/lonmsg.pm between versions 1.12 and 1.14

version 1.12, 2001/08/03 14:00:07 version 1.14, 2001/08/03 17:16:48
Line 201  sub statuschange { Line 201  sub statuschange {
             ($status{$msgid} eq 'forwarded')) {              ($status{$msgid} eq 'forwarded')) {
  &Apache::lonnet::put('email_status',{$msgid => $newstatus});   &Apache::lonnet::put('email_status',{$msgid => $newstatus});
     }      }
       if (($newstatus eq 'deleted') || ($newstatus eq 'new')) {
    &Apache::lonnet::put('email_status',{$msgid => $newstatus});
       }
 }  }
 # ===================================================================== Handler  
   # ==================================================== Display Critical Message
   
 sub discrit {  sub discrit {
     my $r=shift;      my $r=shift;
Line 216  sub discrit { Line 220  sub discrit {
   $r->print('<hr>From: <b>'.$content{'sendername'}.'@'.    $r->print('<hr>From: <b>'.$content{'sendername'}.'@'.
                     $content{'senderdomain'}.'</b> ('.$content{'time'}.                      $content{'senderdomain'}.'</b> ('.$content{'time'}.
                     ')<br><blockquote>'.$content{'message'}.'</blockquote>'.                      ')<br><blockquote>'.$content{'message'}.'</blockquote>'.
   '<input type=submit name="rec_'.$_.'" value="Confirm Receipt">');    '<input type=submit name="rec_'.$_.'" value="Confirm Receipt">'.
    '<input type=submit name="reprec_'.$_.'" value="Confirm Receipt and Reply">');
       } sort keys %what;        } sort keys %what;
       $r->print('</form>');        $r->print('</form>');
 }  }
   
   # =============================================================== Compose reply
   
   sub comprep {
       my ($r,$msgid)=@_;
         my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
         my %content=&unpackagemsg($message{$msgid});
         my $quotemsg='> '.$content{'message'};
         $quotemsg=~s/\r/\n/g;
         $quotemsg=~s/\f/\n/g;
         $quotemsg=~s/\n+/\n\> /g;
         my $subject='Re: '.$content{'subject'};
         my $dispcrit='';
         if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
            $dispcrit=
        '<input type=checkbox name=critmsg> Send as critical message<p>';
         }
         $r->print(<<"ENDREPLY");
   <form action="/adm/email" method=post>
   <input type=hidden name=sendreply value="$msgid">
   Subject: <input type=text size=50 name=subject value="$subject"><p>
   <textarea name=message cols=60 rows=10>
   $quotemsg
   </textarea><p>
   $dispcrit
   <input type=submit value="Send Reply">
   </form>
   ENDREPLY
   }
   
   sub disall {
       my $r=shift;
       $r->print('<h1>Display All Messages</h1>'.
        '<table border=2><tr><th colspan=2>&nbsp</th><th>Date</th>'.
        '<th>Username</th><th>Domain</th><th>Subject</th><th>Status</th></tr>');
       map {
           my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
       &Apache::lonmsg::unpackmsgid($_);
          unless ($status eq 'deleted') {
           if ($status eq 'new') {
       $r->print('<tr bgcolor="#FFBB77">');
           } elsif ($status eq 'read') {
       $r->print('<tr bgcolor="#BBBB77">');
           } elsif ($status eq 'replied') {
       $r->print('<tr bgcolor="#AAAA88">');
    } else {
       $r->print('<tr bgcolor="#99BBBB">');
           }
           $r->print('<td><a href="/adm/email?display='.$_.
                     '">Open</a></td><td><a href="/adm/email?markdel='.$_.
                     '">Delete</a></td><td>'.localtime($sendtime).'</td><td>'.
                     $fromname.'</td><td>'.$fromdomain.'</td><td>'.
         &Apache::lonnet::unescape($shortsubj).'</td><td>'.
                         $status.'</td></tr>');
          }
       } sort split(/\&/,&Apache::lonnet::reply('keys:'.
    $ENV{'user.domain'}.':'.
                                           $ENV{'user.name'}.':nohist_email',
                                           $ENV{'user.home'}));
       $r->print('</table></body></html>');
   }
   
   # ===================================================================== Handler
   
 sub handler {  sub handler {
     my $r=shift;      my $r=shift;
   
Line 238  sub handler { Line 306  sub handler {
        $value =~ tr/+/ /;         $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;         $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
        if (($name eq 'display') || ($name eq 'replyto') ||          if (($name eq 'display') || ($name eq 'replyto') || 
            ($name eq 'forward') || ($name eq 'mark') ||             ($name eq 'forward') || ($name eq 'markread') ||
              ($name eq 'markdel') || ($name eq 'markunread') ||
            ($name eq 'sendreply') || ($name eq 'compose') ||             ($name eq 'sendreply') || ($name eq 'compose') ||
            ($name eq 'sendmail') || ($name eq 'critical')) {             ($name eq 'sendmail') || ($name eq 'critical')) {
            unless ($ENV{'form.'.$name}) {             unless ($ENV{'form.'.$name}) {
Line 261  sub handler { Line 330  sub handler {
       $r->print('<b>Subject:</b> '.$content{'subject'}.        $r->print('<b>Subject:</b> '.$content{'subject'}.
              '<br><b>From:</b> '.$content{'sendername'}.' at '.               '<br><b>From:</b> '.$content{'sendername'}.' at '.
                                  $content{'senderdomain'}.                                   $content{'senderdomain'}.
              '<br><b>Time:</b> '.$content{'time'}.'<hr>Functions: '.               '<br><b>Time:</b> '.$content{'time'}.'<p>'.
              '<a href="/adm/email?replyto='.&Apache::lonnet::escape($msgid).               '<table border=2><tr bgcolor="#FFFFAA"><td>Functions:</td>'.
              '"><b>Reply</b></a><hr><pre>'.             '<td><a href="/adm/email?replyto='.&Apache::lonnet::escape($msgid).
                '"><b>Reply</b></a></td>'.
              '<td><a href="/adm/email?replyto='.&Apache::lonnet::escape($msgid).
                '"><b>Forward</b></a></td>'.
                '</tr></table><p><pre>'.
              $content{'message'}.'</pre><hr>'.$content{'citation'});               $content{'message'}.'</pre><hr>'.$content{'citation'});
   } elsif ($ENV{'form.replyto'}) {    } elsif ($ENV{'form.replyto'}) {
       my $msgid=$ENV{'form.replyto'};        &comprep($r,$ENV{'form.replyto'});
       my %message=&Apache::lonnet::get('nohist_email',[$msgid]);  
       my %content=&unpackagemsg($message{$msgid});  
       my $quotemsg='> '.$content{'message'};  
       $quotemsg=~s/\r/\n/g;  
       $quotemsg=~s/\f/\n/g;  
       $quotemsg=~s/\n+/\n\> /g;  
       my $subject='Re: '.$content{'subject'};  
       my $dispcrit='';  
       if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {  
          $dispcrit=  
      '<input type=checkbox name=critmsg> Send as critical message<p>';  
       }  
       $r->print(<<"ENDREPLY");  
 <form action="/adm/email" method=post>  
 <input type=hidden name=sendreply value="$msgid">  
 Subject: <input type=text size=50 name=subject value="$subject"><p>  
 <textarea name=message cols=60 rows=10>  
 $quotemsg  
 </textarea><p>  
 $dispcrit  
 <input type=submit value="Send Reply">  
 </form>  
 ENDREPLY  
   } elsif ($ENV{'form.sendreply'}) {    } elsif ($ENV{'form.sendreply'}) {
       my $msgid=$ENV{'form.sendreply'};        my $msgid=$ENV{'form.sendreply'};
       my %message=&Apache::lonnet::get('nohist_email',[$msgid]);        my %message=&Apache::lonnet::get('nohist_email',[$msgid]);
Line 308  ENDREPLY Line 358  ENDREPLY
                                  $ENV{'form.subject'},                                   $ENV{'form.subject'},
                                  $ENV{'form.message'}));                                   $ENV{'form.message'}));
       }        }
         if ($ENV{'form.displayedcrit'}) {
             &discrit($r);
         } else {
     &disall($r);
         }
   } elsif ($ENV{'form.confirm'}) {    } elsif ($ENV{'form.confirm'}) {
       map {        map {
           if ($_=~/^form\.rec\_(.*)$/) {            if ($_=~/^form\.rec\_(.*)$/) {
       $r->print('<b>Confirming Receipt:</b> '.        $r->print('<b>Confirming Receipt:</b> '.
                         &user_crit_received($1).'<br>');                          &user_crit_received($1).'<br>');
           }            }
             if ($_=~/^form\.reprec\_(.*)$/) {
                 my $msgid=$1;
         $r->print('<b>Confirming Receipt:</b> '.
                           &user_crit_received($msgid).'<br>');
                 &comprep($r,$msgid);
             }
       } keys %ENV;        } keys %ENV;
       &discrit($r);        &discrit($r);
   } elsif ($ENV{'form.critical'}) {    } elsif ($ENV{'form.critical'}) {
       &discrit($r);        &discrit($r);
   } elsif ($ENV{'form.forward'}) {    } elsif ($ENV{'form.forward'}) {
   } elsif ($ENV{'form.mark'}) {    } elsif ($ENV{'form.markread'}) {
     } elsif ($ENV{'form.markdel'}) {
         &statuschange($ENV{'form.markdel'},'deleted');
         &disall($r);
     } elsif ($ENV{'form.markunread'}) {
   } elsif ($ENV{'form.compose'}) {    } elsif ($ENV{'form.compose'}) {
       my $dispcrit='';        my $dispcrit='';
       if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {        if (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
Line 338  $dispcrit Line 403  $dispcrit
 ENDCOMP  ENDCOMP
   } elsif ($ENV{'form.sendmail'}) {    } elsif ($ENV{'form.sendmail'}) {
   } else {    } else {
     $r->print('<table border=2><tr><th>&nbsp</th><th>Date</th>'.        &disall($r);
      '<th>Username</th><th>Domain</th><th>Subject</th><th>Status</th></tr>');  
     map {  
         my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=  
     &Apache::lonmsg::unpackmsgid($_);  
         if ($status eq 'new') {  
     $r->print('<tr bgcolor="#FFBB77">');  
         } elsif ($status eq 'read') {  
     $r->print('<tr bgcolor="#BBBB77">');  
         } elsif ($status eq 'replied') {  
     $r->print('<tr bgcolor="#AAAA88">');  
  } else {  
     $r->print('<tr bgcolor="#99BBBB">');  
         }  
         $r->print('<td><a href="/adm/email?display='.$_.  
                   '">Open</a></td><td>'.localtime($sendtime).'</td><td>'.  
                   $fromname.'</td><td>'.$fromdomain.'</td><td>'.  
       &Apache::lonnet::unescape($shortsubj).'</td><td>'.  
                       $status.'</td></tr>');  
     } sort split(/\&/,&Apache::lonnet::reply('keys:'.  
  $ENV{'user.domain'}.':'.  
                                         $ENV{'user.name'}.':nohist_email',  
                                         $ENV{'user.home'}));  
     $r->print('</table></body></html>');  
   
   }    }
   $r->print('</body></html>');    $r->print('</body></html>');
   return OK;    return OK;

Removed from v.1.12  
changed lines
  Added in v.1.14


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