Diff for /loncom/interface/lonmsg.pm between versions 1.71.2.1 and 1.79

version 1.71.2.1, 2004/03/01 23:06:17 version 1.79, 2004/01/15 15:12:31
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 270  sub author_res_msg { Line 255  sub author_res_msg {
     my ($filename,$message)=@_;      my ($filename,$message)=@_;
     unless ($message) { return 'empty'; }      unless ($message) { return 'empty'; }
     $filename=&Apache::lonnet::declutter($filename);      $filename=&Apache::lonnet::declutter($filename);
     my ($domain,$author)=split(/\//,$filename);      my ($domain,$author,@dummy)=split(/\//,$filename);
     my $homeserver=&Apache::lonnet::homeserver($author,$domain);      my $homeserver=&Apache::lonnet::homeserver($author,$domain);
     if ($homeserver ne 'no_host') {      if ($homeserver ne 'no_host') {
        my $id=unpack("%32C*",$message);         my $id=unpack("%32C*",$message);
        my $msgid;         my $msgid;
        ($msgid,$message)=&packagemsg("Error: [$filename]",$message);         ($msgid,$message)=&packagemsg($filename,$message);
        #FIXME this should be nohist_res_msg, we need to provide an interface   
        #      to this hash BUG#2444  
        #return &Apache::lonnet::reply('put:'.$domain.':'.$author.  
        #  ':nohist_res_msg:'.  
        #   &Apache::lonnet::escape($filename.'_'.$id).'='.  
        #   &Apache::lonnet::escape($message),$homeserver);  
        return &Apache::lonnet::reply('put:'.$domain.':'.$author.         return &Apache::lonnet::reply('put:'.$domain.':'.$author.
    ':nohist_email:'.           ':nohist_res_msgs:'.
            &Apache::lonnet::escape($msgid).'='.            &Apache::lonnet::escape($filename.'_'.$id).'='.
            &Apache::lonnet::escape($message),$homeserver);            &Apache::lonnet::escape($message),$homeserver);
     }      }
     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,$file)=($url=~/^(\w+)\/(\w+)\/(.+)$/);
       my $listall=($file eq 'allbombs');
       my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$domain,$author);
       my $msgs='';
       foreach (keys %errormsgs) {
    if (($_=~/^\Q$url\E\_\d+$/) || ($listall)) {
       my ($errurl)=($_=~/^(.+)\_(\d+)$/);
       my %content=&unpackagemsg($errormsgs{$_});
       $msgs.='<p><img src="/adm/lonMisc/bomb.gif" /><b>'.
    ($listall?"<a href='".&Apache::lonnet::clutter($errurl)."'><tt>".
    $errurl.
    '</tt></a> ':' ').
    $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 839  ENDCOMP Line 870  ENDCOMP
     } else { # $broadcast is 'upload'      } else { # $broadcast is 'upload'
  $r->print(<<ENDUPLOAD);   $r->print(<<ENDUPLOAD);
 <input type=hidden name=sendmode value=upload>  <input type=hidden name=sendmode value=upload>
 <input type="hidden" name="send" value="on" />  
 <h3>Generate messages from a file</h3>  <h3>Generate messages from a file</h3>
 <p>  <p>
 Subject: <input type=text size=50 name=subject>  Subject: <input type=text size=50 name=subject>
Line 999  sub handler { Line 1029  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 1026  sub handler { Line 1058  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(

Removed from v.1.71.2.1  
changed lines
  Added in v.1.79


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