File:
[LON-CAPA] /
loncom /
interface /
loncommunicate.pm
Revision
1.11:
download - view:
text,
annotated -
select for diffs
Wed Aug 21 17:18:08 2002 UTC (22 years, 1 month ago) by
www
Branches:
MAIN
CVS tags:
HEAD
Starting to implement common header and color scheme for LON-CAPA handlers
(non-content pages).
Instead of <body bgcolor="#...."><h1>... call
&Apache::loncommon::bodytag(title,[role],[add_body_parms]);
title: what it says in the header
role (OPTIONAL): override role choice
('admin','coordinator','student','author')
add_body_parms: additional parameters to be put into the body tag, for
example 'onLoad="init();" or stuff
Colors and layout will likely change in the future, including domain
customization, help function calls, (css?)
1: # The LearningOnline Network
2: # Communicate
3: #
4: # $Id: loncommunicate.pm,v 1.11 2002/08/21 17:18:08 www Exp $
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: #
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: #
36: # 3/1,2/6,7/27,8/3,8/15,
37: # 11/5/01 Gerd Kortemeyer
38: #
39: package Apache::loncommunicate;
40:
41: use strict;
42: use Apache::Constants qw(:common);
43: use Apache::lonmsg();
44: use Apache::loncommon;
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;
51: #
52: # Start document
53: #
54: $r->print(<<END);
55: <html>
56: <head>
57: <title>The LearningOnline Network with CAPA</title>
58: </head>
59: END
60: $r->print(&Apache::loncommon::bodytag("Communication and Messages"));
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
73: if (($ENV{'request.course.id'}) &&
74: (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
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">
80: <b><a href="/adm/email?compose=upload">Upload messages to course</a></b>
81: </td></tr>
82: END
83: }
84: $r->print('</table>');
85: my @msgids = sort split(/\&/,&Apache::lonnet::reply
86: ('keys:'.$ENV{'user.domain'}.':'.
87: $ENV{'user.name'}.':nohist_email',
88: $ENV{'user.home'}));
89: my @newmsgs;
90: foreach (@msgids) {
91: my ($sendtime,$shortsubj,$fromname,$fromdom,$status)=
92: &Apache::lonmsg::unpackmsgid($_);
93: if ($sendtime!~/error/) {
94: $sendtime = localtime($sendtime);
95: if ($status eq 'new') {
96: push @newmsgs, {
97: msgid => $_,
98: sendtime => $sendtime,
99: shortsub => &Apache::lonnet::unescape($shortsubj),
100: from => $fromname,
101: fromdom => $fromdom
102: }
103: }
104: }
105: }
106: if ($#newmsgs >= 0) {
107: $r->print(<<TABLEHEAD);
108: <h3>New Messages</h3>
109: <table border=2><tr><th> </th>
110: <th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr>
111: TABLEHEAD
112: foreach my $msg (@newmsgs) {
113: $r->print(<<"ENDLINK");
114: <tr bgcolor="#FFBB77">
115: <td><a href="/adm/email?display=$msg->{'msgid'}">Open</a></td>
116: ENDLINK
117: foreach ('sendtime','from','fromdom','shortsub') {
118: $r->print("<td>$msg->{$_}</td>");
119: }
120: $r->print("</td></tr>");
121: }
122: $r->print('</table></body></html>');
123: } else {
124: $r->print("<h3>You have no unread messages</h3>");
125: }
126: return OK;
127: }
128:
129: 1;
130: __END__
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>