Annotation of loncom/interface/loncommunicate.pm, revision 1.13
1.1 www 1: # The LearningOnline Network
2: # Communicate
3: #
1.13 ! www 4: # $Id: loncommunicate.pm,v 1.12 2002/09/16 20:06:12 albertel 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.11 www 44: use Apache::loncommon;
1.1 www 45:
46: sub handler {
47: my $r = shift;
48: $r->content_type('text/html');
49: $r->send_http_header;
50: return OK if $r->header_only;
1.2 www 51: #
52: # Start document
53: #
1.9 matthew 54: $r->print(<<END);
1.1 www 55: <html>
56: <head>
57: <title>The LearningOnline Network with CAPA</title>
58: </head>
1.9 matthew 59: END
1.11 www 60: $r->print(&Apache::loncommon::bodytag("Communication and Messages"));
1.9 matthew 61: $r->print(<<END);
62: <table cellspacing="10" cellpadding="2">
63: <tr><td bgcolor="#FFFFAA">
64: <b><a href="/adm/email/">View All Messages</a></b>
65: </td></tr>
66: <tr><td bgcolor="#FFFFAA">
67: <b><a href="/adm/email?critical=display">View Critical Messages</a></b>
68: </td></tr>
69: <tr><td bgcolor="#FFFFAA">
70: <b><a href="/adm/email?compose=individual">Send message to user(s)</a></b>
71: </td></tr>
72: END
1.4 www 73: if (($ENV{'request.course.id'}) &&
74: (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
1.9 matthew 75: $r->print(<<END);
76: <tr><td bgcolor="#FFFFAA">
77: <b><a href="/adm/email?compose=group">Broadcast message to course</a></b>
78: </td></tr>
79: <tr><td bgcolor="#FFFFAA">
1.13 ! www 80: <b><a href="/adm/email?compose=upload">Distribute messages from uploaded file to course</a></b>
1.9 matthew 81: </td></tr>
1.13 ! www 82: <tr><td bgcolor="#FFFFAA">
! 83: <b><a href="/adm/email?recordftf=query">User records of face-to-face discusssions and messages</a></b>
! 84: </td></tr>
! 85:
1.9 matthew 86: END
1.4 www 87: }
1.9 matthew 88: $r->print('</table>');
89: my @msgids = sort split(/\&/,&Apache::lonnet::reply
90: ('keys:'.$ENV{'user.domain'}.':'.
91: $ENV{'user.name'}.':nohist_email',
92: $ENV{'user.home'}));
93: my @newmsgs;
94: foreach (@msgids) {
95: my ($sendtime,$shortsubj,$fromname,$fromdom,$status)=
96: &Apache::lonmsg::unpackmsgid($_);
1.12 albertel 97: if (defined($sendtime) && $sendtime!~/error/) {
1.9 matthew 98: $sendtime = localtime($sendtime);
99: if ($status eq 'new') {
100: push @newmsgs, {
101: msgid => $_,
102: sendtime => $sendtime,
103: shortsub => &Apache::lonnet::unescape($shortsubj),
104: from => $fromname,
105: fromdom => $fromdom
106: }
107: }
1.10 www 108: }
1.9 matthew 109: }
110: if ($#newmsgs >= 0) {
111: $r->print(<<TABLEHEAD);
1.2 www 112: <h3>New Messages</h3>
113: <table border=2><tr><th> </th>
114: <th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr>
1.9 matthew 115: TABLEHEAD
116: foreach my $msg (@newmsgs) {
117: $r->print(<<"ENDLINK");
118: <tr bgcolor="#FFBB77">
119: <td><a href="/adm/email?display=$msg->{'msgid'}">Open</a></td>
120: ENDLINK
121: foreach ('sendtime','from','fromdom','shortsub') {
122: $r->print("<td>$msg->{$_}</td>");
123: }
124: $r->print("</td></tr>");
1.2 www 125: }
1.9 matthew 126: $r->print('</table></body></html>');
127: } else {
128: $r->print("<h3>You have no unread messages</h3>");
1.8 harris41 129: }
1.1 www 130: return OK;
1.2 www 131: }
1.1 www 132:
133: 1;
134: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>