Diff for /loncom/interface/lonmsg.pm between versions 1.69 and 1.84

version 1.69, 2003/10/15 21:10:24 version 1.84, 2004/01/31 02:42:44
Line 25 Line 25
 #  #
 # http://www.lon-capa.org/  # http://www.lon-capa.org/
 #  #
 #  
 # (Routines to control the menu  
 #  
 # (TeX Conversion Module  
 #  
 # 05/29/00,05/30 Gerd Kortemeyer)  
 #  
 # 10/05 Gerd Kortemeyer)  
 #  
 # 10/19,10/20,10/30,  
 # 02/06/01 Gerd Kortemeyer  
 # 07/27 Guy Albertelli  
 # 07/27,07/28,07/30,08/03,08/06,08/08,08/09,08/10,8/13,8/15,  
 # 10/1,11/5 Gerd Kortemeyer  
 # YEAR=2002  
 # 1/1,3/18 Gerd Kortemeyer  
 #  
 package Apache::lonmsg;  package Apache::lonmsg;
   
 =pod  =pod
Line 284  sub author_res_msg { Line 269  sub author_res_msg {
     return 'no_host';      return 'no_host';
 }  }
   
   # =========================================== Retrieve author resource messages
   
   sub retrieve_author_res_msg {
       my $url=shift;
       $url=&Apache::lonnet::declutter($url);
       my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//);
       my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$domain,$author);
       my $msgs='';
       foreach (keys %errormsgs) {
    if ($_=~/^\Q$url\E\_\d+$/) {
       my %content=&unpackagemsg($errormsgs{$_});
       $msgs.='<p><img src="/adm/lonMisc/bomb.gif" /><b>'.
    $content{'time'}.'</b>: '.$content{'message'}.
    '<br /></p>';
    }
       } 
       return $msgs;     
   }
   
   
   # =============================== Delete all author messages related to one URL
   
   sub del_url_author_res_msg {
       my $url=shift;
       $url=&Apache::lonnet::declutter($url);
       my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//);
       my @delmsgs=();
       foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) {
    if ($_=~/^\Q$url\E\_\d+$/) {
       push (@delmsgs,$_);
    }
       }
       return &Apache::lonnet::del('nohist_res_msgs',\@delmsgs,$domain,$author);
   }
   
   # ================= Return hash with URLs for which there is a resource message
   
   sub all_url_author_res_msg {
       my ($author,$domain)=@_;
       my %returnhash=();
       foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) {
    $_=~/^(.+)\_\d+/;
    $returnhash{$1}=1;
       }
       return %returnhash;
   }
   
 # ================================================== Critical message to a user  # ================================================== Critical message to a user
   
 sub user_crit_msg_raw {  sub user_crit_msg_raw {
Line 364  sub user_crit_received { Line 396  sub user_crit_received {
     my %contents=&unpackagemsg($message{$msgid},1);      my %contents=&unpackagemsg($message{$msgid},1);
     my $status='rec: '.($contents{'sendback'}?      my $status='rec: '.($contents{'sendback'}?
      &user_normal_msg($contents{'sendername'},$contents{'senderdomain'},       &user_normal_msg($contents{'sendername'},$contents{'senderdomain'},
                      &mt('Receipt').': '.$ENV{'user.name'}.' at '.$ENV{'user.domain'},                       &mt('Receipt').': '.$ENV{'user.name'}.' '.&mt('at').' '.$ENV{'user.domain'}.', '.$contents{'subject'},
                      &mt('User').' '.$ENV{'user.name'}.' '.&mt('at').' '.$ENV{'user.domain'}.                       &mt('User').' '.$ENV{'user.name'}.' '.&mt('at').' '.$ENV{'user.domain'}.
                      ' acknowledged receipt of message'."\n".'   "'.                       ' acknowledged receipt of message'."\n".'   "'.
                      $contents{'subject'}.'"'."\n".&mt('dated').' '.                       $contents{'subject'}.'"'."\n".&mt('dated').' '.
Line 567  $content{'sendername'}.'@'. Line 599  $content{'sendername'}.'@'.
             '<br>'.&mt('Subject').': '.$content{'subject'}.              '<br>'.&mt('Subject').': '.$content{'subject'}.
             '<br><blockquote>'.              '<br><blockquote>'.
               &Apache::lontexconvert::msgtexconverted($content{'message'}).                &Apache::lontexconvert::msgtexconverted($content{'message'}).
             '</blockquote>'.              '</blockquote><small>'.
   &mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox').
               '</small><br />'.
             '<input type=submit name="rec_'.$_.'" value="'.&mt('Confirm Receipt').'">'.              '<input type=submit name="rec_'.$_.'" value="'.&mt('Confirm Receipt').'">'.
             '<input type=submit name="reprec_'.$_.'" '.              '<input type=submit name="reprec_'.$_.'" '.
                   'value="'.&mt('Confirm Receipt and Reply').'">';                    'value="'.&mt('Confirm Receipt and Reply').'">';
Line 992  sub handler { Line 1026  sub handler {
   if (!$ENV{'form.display'}) {    if (!$ENV{'form.display'}) {
       $r->print('<html><head><title>EMail and Messaging</title>'.        $r->print('<html><head><title>EMail and Messaging</title>'.
  &Apache::loncommon::studentbrowser_javascript().'</head>'.   &Apache::loncommon::studentbrowser_javascript().'</head>'.
  &Apache::loncommon::bodytag('EMail and Messages'));   &Apache::loncommon::bodytag('EMail and Messages').
        &Apache::loncommon::help_open_faq(12).
        &Apache::loncommon::help_open_bug('Communication Tools'));
   }    }
   if ($ENV{'form.display'}) {    if ($ENV{'form.display'}) {
       my $msgid=$ENV{'form.display'};        my $msgid=$ENV{'form.display'};
Line 1019  sub handler { Line 1055  sub handler {
       }        }
       $r->print(&Apache::loncommon::studentbrowser_javascript().        $r->print(&Apache::loncommon::studentbrowser_javascript().
  '</head>'.   '</head>'.
  &Apache::loncommon::bodytag('EMail and Messages'));   &Apache::loncommon::bodytag('EMail and Messages').
        &Apache::loncommon::help_open_faq(12).
        &Apache::loncommon::help_open_bug('Communication Tools'));
       $r->print('<b>'.&mt('Subject').':</b> '.$content{'subject'}.        $r->print('<b>'.&mt('Subject').':</b> '.$content{'subject'}.
              '<br><b>'.&mt('From').':</b> '.               '<br><b>'.&mt('From').':</b> '.
 &Apache::loncommon::aboutmewrapper(  &Apache::loncommon::aboutmewrapper(
Line 1048  $content{'sendername'},$content{'senderd Line 1086  $content{'sendername'},$content{'senderd
            '"><b>'.&mt('Next').'</b></a></td>');             '"><b>'.&mt('Next').'</b></a></td>');
        }         }
        $r->print('</tr></table><p><pre>'.         $r->print('</tr></table><p><pre>'.
              &Apache::lontexconvert::msgtexconverted($content{'message'}).               &Apache::lontexconvert::msgtexconverted($content{'message'},1).
              '</pre><hr>'.$content{'citation'});               '</pre><hr>'.$content{'citation'});
   } elsif ($ENV{'form.replyto'}) {    } elsif ($ENV{'form.replyto'}) {
       &comprep($r,$ENV{'form.replyto'});        &comprep($r,$ENV{'form.replyto'});
Line 1060  $content{'sendername'},$content{'senderd Line 1098  $content{'sendername'},$content{'senderd
   &statuschange($msgid,'replied');    &statuschange($msgid,'replied');
   if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&     if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
       (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {        (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
       $r->print(&mt('Sending critical').': '.        $r->print(&mt('Sending critical message').': '.
  &user_crit_msg($content{'sendername'},   &user_crit_msg($content{'sendername'},
        $content{'senderdomain'},         $content{'senderdomain'},
        &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),         &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
Line 1118  $content{'sendername'},$content{'senderd Line 1156  $content{'sendername'},$content{'senderd
   } elsif ($ENV{'form.recordftf'}) {    } elsif ($ENV{'form.recordftf'}) {
       &facetoface($r,$ENV{'form.recordftf'});        &facetoface($r,$ENV{'form.recordftf'});
   } elsif ($ENV{'form.sendmail'}) {    } elsif ($ENV{'form.sendmail'}) {
         my $sendstatus='';
       if ($ENV{'form.send'}) {        if ($ENV{'form.send'}) {
   my %content=();    my %content=();
   undef %content;    undef %content;
Line 1160  $content{'sendername'},$content{'senderd Line 1199  $content{'sendername'},$content{'senderd
       if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; }            if ($toaddr{$_}) { $msgtxt.='<hr>'.$toaddr{$_}; }    
       if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) &&         if ((($ENV{'form.critmsg'}) || ($ENV{'form.sendbck'})) && 
   (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {    (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
   $r->print('Sending critical: '.    $r->print(&mt('Sending critical message').' ...');
     &user_crit_msg($recuname,$recdomain,                    $sendstatus.=' '.&user_crit_msg($recuname,$recdomain,
    &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),     &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
    $msgtxt,     $msgtxt,
    $ENV{'form.sendbck'}));     $ENV{'form.sendbck'});
       } else {        } else {
   $r->print('Sending: '.&user_normal_msg($recuname,$recdomain,    $r->print(&mt('Sending').' ...');
  &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),                    $sendstatus.=' '.&user_normal_msg($recuname,$recdomain,
                            &Apache::lonfeedback::clear_out_html($ENV{'form.subject'}),
  $msgtxt,   $msgtxt,
  $content{'citation'}));   $content{'citation'});
       }        }
       $r->print('<br />');        $r->print('<br />');
   }    }
       }        }
       if ($ENV{'form.displayedcrit'}) {        if ($sendstatus=~/^(\s*(?:ok|con_delayed)\s*)*$/) {
           &discrit($r);    $r->print('<br /><font color="green">'.&mt('Completed.').'</font>');
     if ($ENV{'form.displayedcrit'}) {
         &discrit($r);
     } else {
         &disall($r);
     }
       } else {        } else {
   &disall($r);    $r->print(
     '<h2><font color="red">'.&mt('Could not deliver message').'</font></h2>'.
     &mt('Please use the browser "Back" button and correct the recipient addresses')
       );
       }        }
   } else {    } else {
       &disall($r);        &disall($r);

Removed from v.1.69  
changed lines
  Added in v.1.84


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