Annotation of loncom/interface/loncommunicate.pm, revision 1.21
1.1 www 1: # The LearningOnline Network
2: # Communicate
3: #
1.21 ! www 4: # $Id: loncommunicate.pm,v 1.20 2004/03/01 02:21:57 www 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.20 www 28: ###
29:
1.1 www 30: package Apache::loncommunicate;
31:
32: use strict;
33: use Apache::Constants qw(:common);
1.2 www 34: use Apache::lonmsg();
1.11 www 35: use Apache::loncommon;
1.16 www 36: use Apache::lonlocal;
1.1 www 37:
1.21 ! www 38: sub menu {
! 39: my $r=shift;
! 40: my %lt=&Apache::lonlocal::texthash(
1.16 www 41: 'vam' => 'View All Messages',
42: 'vcm' => 'View Critical Messages',
43: 'smu' => 'Send Message to User(s)',
44: 'bmc' => 'Broadcast Message to Course',
45: 'dmu' => 'Distribute Messages from Uploaded File to Course',
46: 'unr' =>
47: 'User Notes, Records of Face-to-Face Discussions, and Critical Messages',
48: 'nm' => 'New Messages',
49: 'su' => 'Subject',
50: 'da' => 'Date',
51: 'us' => 'Username',
52: 'op' => 'Open',
53: 'do' => 'Domain'
54: );
1.18 www 55: my %help=();
56: foreach ('Course_Face_To_Face_Records,Course_Critical_Message',
57: 'Course_Broadcast_Message') {
58: $help{$_}=&Apache::loncommon::help_open_topic($_);
59: }
1.20 www 60: # ------------------------------------------------------------------------ Menu
1.9 matthew 61: $r->print(<<END);
62: <table cellspacing="10" cellpadding="2">
63: <tr><td bgcolor="#FFFFAA">
1.16 www 64: <b><a href="/adm/email/">$lt{'vam'}</a></b>
1.9 matthew 65: </td></tr>
66: <tr><td bgcolor="#FFFFAA">
1.16 www 67: <b><a href="/adm/email?critical=display">$lt{'vcm'}</a></b>
1.9 matthew 68: </td></tr>
69: <tr><td bgcolor="#FFFFAA">
1.16 www 70: <b><a href="/adm/email?compose=individual">$lt{'smu'}</a></b>
1.9 matthew 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">
1.18 www 77: <b><a href="/adm/email?compose=group">$lt{'bmc'}</a></b>$help{'Course_Broadcast_Message'}
1.9 matthew 78: </td></tr>
79: <tr><td bgcolor="#FFFFAA">
1.16 www 80: <b><a href="/adm/email?compose=upload">$lt{'dmu'}</a></b>
1.9 matthew 81: </td></tr>
1.13 www 82: <tr><td bgcolor="#FFFFAA">
1.18 www 83: <b><a href="/adm/email?recordftf=query">$lt{'unr'}</a></b>$help{'Course_Face_To_Face_Records,Course_Critical_Message'}
1.13 www 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.17 www 98: $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
1.9 matthew 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.20 www 112: <h2>$lt{'nm'}</h2>
1.2 www 113: <table border=2><tr><th> </th>
1.16 www 114: <th>$lt{'da'}</th><th>$lt{'us'}</th><th>$lt{'do'}</th><th>$lt{'su'}</th></tr>
1.9 matthew 115: TABLEHEAD
116: foreach my $msg (@newmsgs) {
117: $r->print(<<"ENDLINK");
118: <tr bgcolor="#FFBB77">
1.16 www 119: <td><a href="/adm/email?display=$msg->{'msgid'}">$lt{'op'}</a></td>
1.9 matthew 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 {
1.16 www 128: $r->print("<h3>".&mt('You have no unread messages')."</h3>");
1.8 harris41 129: }
1.21 ! www 130: }
! 131:
! 132: sub handler {
! 133: my $r = shift;
! 134: &Apache::loncommon::content_type($r,'text/html');
! 135: $r->send_http_header;
! 136: return OK if $r->header_only;
! 137: #
! 138: # Start document
! 139: #
! 140: $r->print(<<END);
! 141: <html>
! 142: <head>
! 143: <title>The LearningOnline Network with CAPA</title>
! 144: </head>
! 145: END
! 146:
! 147: # ----------------------------------------------------------------- Breadcrumbs
! 148: &Apache::lonhtmlcommon::clear_breadcrumbs();
! 149: &Apache::lonhtmlcommon::add_breadcrumb
! 150: ({href=>"/adm/communicate",
! 151: text=>"Communication/Messages",
! 152: faq=>12,bug=>'Communication Tools',});
! 153:
! 154: # ---------------------------------------------------------------------- Header
! 155: &Apache::lonmsg::header($r);
! 156: &menu($r);
1.1 www 157: return OK;
1.2 www 158: }
1.1 www 159:
160: 1;
161: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>