Annotation of loncom/interface/loncommunicate.pm, revision 1.10
1.1 www 1: # The LearningOnline Network
2: # Communicate
3: #
1.10 ! www 4: # $Id: loncommunicate.pm,v 1.9 2002/05/07 19:24:28 matthew Exp $
1.7 albertel 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.1 www 28: # (Internal Server Error Handler
29: #
30: # (Login Screen
31: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14,
32: # 1/14/00,5/29,5/30,6/1,6/29,7/1,11/9 Gerd Kortemeyer)
33: #
34: # 3/1/1 Gerd Kortemeyer)
35: #
1.6 www 36: # 3/1,2/6,7/27,8/3,8/15,
37: # 11/5/01 Gerd Kortemeyer
1.1 www 38: #
39: package Apache::loncommunicate;
40:
41: use strict;
42: use Apache::Constants qw(:common);
1.2 www 43: use Apache::lonmsg();
1.1 www 44:
45: sub handler {
46: my $r = shift;
47: $r->content_type('text/html');
48: $r->send_http_header;
49: return OK if $r->header_only;
1.2 www 50: #
51: # Start document
52: #
1.9 matthew 53: $r->print(<<END);
1.1 www 54: <html>
55: <head>
56: <title>The LearningOnline Network with CAPA</title>
57: </head>
58: <body bgcolor="#FFFFFF">
1.2 www 59: <img align=right src=/adm/lonIcons/lonlogos.gif>
1.1 www 60: <h1>Communicate</h1>
1.9 matthew 61: END
62: $r->print(<<END);
63: <table cellspacing="10" cellpadding="2">
64: <tr><td bgcolor="#FFFFAA">
65: <b><a href="/adm/email/">View All Messages</a></b>
66: </td></tr>
67: <tr><td bgcolor="#FFFFAA">
68: <b><a href="/adm/email?critical=display">View Critical Messages</a></b>
69: </td></tr>
70: <tr><td bgcolor="#FFFFAA">
71: <b><a href="/adm/email?compose=individual">Send message to user(s)</a></b>
72: </td></tr>
73: END
1.4 www 74: if (($ENV{'request.course.id'}) &&
75: (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
1.9 matthew 76: $r->print(<<END);
77: <tr><td bgcolor="#FFFFAA">
78: <b><a href="/adm/email?compose=group">Broadcast message to course</a></b>
79: </td></tr>
80: <tr><td bgcolor="#FFFFAA">
81: <b><a href="/adm/email?compose=upload">Upload messages to course</a></b>
82: </td></tr>
83: END
1.4 www 84: }
1.9 matthew 85: $r->print('</table>');
86: my @msgids = sort split(/\&/,&Apache::lonnet::reply
87: ('keys:'.$ENV{'user.domain'}.':'.
88: $ENV{'user.name'}.':nohist_email',
89: $ENV{'user.home'}));
90: my @newmsgs;
91: foreach (@msgids) {
92: my ($sendtime,$shortsubj,$fromname,$fromdom,$status)=
93: &Apache::lonmsg::unpackmsgid($_);
1.10 ! www 94: if ($sendtime!~/error/) {
1.9 matthew 95: $sendtime = localtime($sendtime);
96: if ($status eq 'new') {
97: push @newmsgs, {
98: msgid => $_,
99: sendtime => $sendtime,
100: shortsub => &Apache::lonnet::unescape($shortsubj),
101: from => $fromname,
102: fromdom => $fromdom
103: }
104: }
1.10 ! www 105: }
1.9 matthew 106: }
107: if ($#newmsgs >= 0) {
108: $r->print(<<TABLEHEAD);
1.2 www 109: <h3>New Messages</h3>
110: <table border=2><tr><th> </th>
111: <th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr>
1.9 matthew 112: TABLEHEAD
113: foreach my $msg (@newmsgs) {
114: $r->print(<<"ENDLINK");
115: <tr bgcolor="#FFBB77">
116: <td><a href="/adm/email?display=$msg->{'msgid'}">Open</a></td>
117: ENDLINK
118: foreach ('sendtime','from','fromdom','shortsub') {
119: $r->print("<td>$msg->{$_}</td>");
120: }
121: $r->print("</td></tr>");
1.2 www 122: }
1.9 matthew 123: $r->print('</table></body></html>');
124: } else {
125: $r->print("<h3>You have no unread messages</h3>");
1.8 harris41 126: }
1.1 www 127: return OK;
1.2 www 128: }
1.1 www 129:
130: 1;
131: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>