File:  [LON-CAPA] / loncom / interface / loncommunicate.pm
Revision 1.6: download - view: text, annotated - select for diffs
Mon Nov 5 20:36:43 2001 UTC (22 years, 7 months ago) by www
Branches: MAIN
CVS tags: HEAD
Jump to critical messages

    1: # The LearningOnline Network
    2: # Communicate
    3: #
    4: # (Internal Server Error Handler
    5: #
    6: # (Login Screen
    7: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
    8: # 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
    9: #
   10: # 3/1/1 Gerd Kortemeyer)
   11: #
   12: # 3/1,2/6,7/27,8/3,8/15,
   13: # 11/5/01 Gerd Kortemeyer
   14: #
   15: package Apache::loncommunicate;
   16: 
   17: use strict;
   18: use Apache::Constants qw(:common);
   19: use Apache::lonmsg();
   20: 
   21: sub handler {
   22:     my $r = shift;
   23:     $r->content_type('text/html');
   24:     $r->send_http_header;
   25:     return OK if $r->header_only;
   26: #
   27: # Start document
   28: #
   29:     $r->print(<<ENDDOCUMENT);
   30: <html>
   31: <head>
   32: <title>The LearningOnline Network with CAPA</title>
   33: </head>
   34: <body bgcolor="#FFFFFF">
   35: <img align=right src=/adm/lonIcons/lonlogos.gif>
   36: <h1>Communicate</h1>
   37: ENDDOCUMENT
   38:     my $st='<table><tr><td bgcolor="#FFFFAA"><b>';
   39:     my $en='</b></td><tr></table>';
   40:    $r->print('<p>'.
   41:  $st.'<a href="/adm/email/">All Messages</a>'.$en.'<p>'.
   42:  $st.'<a href="/adm/email?critical=display">Critical Messages</a>'.$en.'<p>'.
   43:  $st.'<a href="/adm/email?compose=individual">Send message to user(s)</a>'.$en
   44:      );
   45:     if (($ENV{'request.course.id'}) && 
   46:         (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
   47:        $r->print(
   48:     '<p>'.$st.
   49:   '<a href="/adm/email?compose=group">Broadcast message to course</a>'.$en.
   50:     '<p>'.$st.
   51:   '<a href="/adm/email?compose=upload">Upload messages to course</a>'.$en);
   52:     }
   53:     $r->print(<<ENDTABLE);
   54: <h3>New Messages</h3>
   55: <table border=2><tr><th>&nbsp</th>
   56: <th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr>
   57: ENDTABLE
   58:     map {
   59:         my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
   60: 	    &Apache::lonmsg::unpackmsgid($_);
   61:         if ($status eq 'new') {
   62:             $r->print(
   63:               '<tr bgcolor="#FFBB77"><td><a href="/adm/email?display='.$_.
   64:                   '">Open</a></td><td>'.localtime($sendtime).'</td><td>'.
   65:                   $fromname.'</td><td>'.$fromdomain.'</td><td>'.
   66: 		      &Apache::lonnet::unescape($shortsubj).'</td></tr>');
   67:         }
   68:     } sort split(/\&/,&Apache::lonnet::reply('keys:'.
   69: 					$ENV{'user.domain'}.':'.
   70:                                         $ENV{'user.name'}.':nohist_email',
   71:                                         $ENV{'user.home'}));
   72:     $r->print('</table></body></html>');
   73:     return OK;
   74: }
   75: 
   76: 1;
   77: __END__

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