File:  [LON-CAPA] / loncom / interface / loncommunicate.pm
Revision 1.4: download - view: text, annotated - select for diffs
Fri Aug 3 18:09:39 2001 UTC (22 years, 9 months ago) by www
Branches: MAIN
CVS tags: HEAD
Made functions more prominent

# The LearningOnline Network
# Communicate
#
# (Internal Server Error Handler
#
# (Login Screen
# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
# 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
#
# 3/1/1 Gerd Kortemeyer)
#
# 3/1,2/6,7/27,8/3 Gerd Kortemeyer
#
package Apache::loncommunicate;

use strict;
use Apache::Constants qw(:common);
use Apache::lonmsg();

sub handler {
    my $r = shift;
    $r->content_type('text/html');
    $r->send_http_header;
    return OK if $r->header_only;
#
# Start document
#
    $r->print(<<ENDDOCUMENT);
<html>
<head>
<title>The LearningOnline Network with CAPA</title>
</head>
<body bgcolor="#FFFFFF">
<img align=right src=/adm/lonIcons/lonlogos.gif>
<h1>Communicate</h1>
ENDDOCUMENT
    my $st='<table><tr><td bgcolor="#FFFFAA"><b>';
    my $en='</b></td><tr></table>';
   $r->print('<p>'.$st.'<a href="/adm/email/">All Messages</a>'.$en.'<p>'.$st.
   '<a href="/adm/email?compose=individual">Send message to user(s)</a>'.
     $en);
    if (($ENV{'request.course.id'}) && 
        (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
       $r->print(
    '<p>'.$st.
  '<a href="/adm/email?compose=group">Broadcast message to course</a>'.$en);
    }
    $r->print(<<ENDTABLE);
<h3>New Messages</h3>
<table border=2><tr><th>&nbsp</th>
<th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr>
ENDTABLE
    map {
        my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
	    &Apache::lonmsg::unpackmsgid($_);
        if ($status eq 'new') {
            $r->print(
              '<tr bgcolor="#FFBB77"><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></tr>');
        }
    } sort split(/\&/,&Apache::lonnet::reply('keys:'.
					$ENV{'user.domain'}.':'.
                                        $ENV{'user.name'}.':nohist_email',
                                        $ENV{'user.home'}));
    $r->print('</table></body></html>');
    return OK;
}

1;
__END__

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