File:  [LON-CAPA] / loncom / interface / loncommunicate.pm
Revision 1.8: download - view: text, annotated - select for diffs
Tue Feb 5 00:01:32 2002 UTC (22 years, 4 months ago) by harris41
Branches: MAIN
CVS tags: stable_2002_april, HEAD
foreach not map

    1: # The LearningOnline Network
    2: # Communicate
    3: #
    4: # $Id: loncommunicate.pm,v 1.8 2002/02/05 00:01:32 harris41 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: 
   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;
   50: #
   51: # Start document
   52: #
   53:     $r->print(<<ENDDOCUMENT);
   54: <html>
   55: <head>
   56: <title>The LearningOnline Network with CAPA</title>
   57: </head>
   58: <body bgcolor="#FFFFFF">
   59: <img align=right src=/adm/lonIcons/lonlogos.gif>
   60: <h1>Communicate</h1>
   61: ENDDOCUMENT
   62:     my $st='<table><tr><td bgcolor="#FFFFAA"><b>';
   63:     my $en='</b></td><tr></table>';
   64:    $r->print('<p>'.
   65:  $st.'<a href="/adm/email/">All Messages</a>'.$en.'<p>'.
   66:  $st.'<a href="/adm/email?critical=display">Critical Messages</a>'.$en.'<p>'.
   67:  $st.'<a href="/adm/email?compose=individual">Send message to user(s)</a>'.$en
   68:      );
   69:     if (($ENV{'request.course.id'}) && 
   70:         (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
   71:        $r->print(
   72:     '<p>'.$st.
   73:   '<a href="/adm/email?compose=group">Broadcast message to course</a>'.$en.
   74:     '<p>'.$st.
   75:   '<a href="/adm/email?compose=upload">Upload messages to course</a>'.$en);
   76:     }
   77:     $r->print(<<ENDTABLE);
   78: <h3>New Messages</h3>
   79: <table border=2><tr><th>&nbsp</th>
   80: <th>Date</th><th>Username</th><th>Domain</th><th>Subject</th></tr>
   81: ENDTABLE
   82:     foreach (sort split(/\&/,&Apache::lonnet::reply('keys:'.
   83: 					$ENV{'user.domain'}.':'.
   84:                                         $ENV{'user.name'}.':nohist_email',
   85: 					$ENV{'user.home'}))) {
   86:         my ($sendtime,$shortsubj,$fromname,$fromdomain,$status)=
   87: 	    &Apache::lonmsg::unpackmsgid($_);
   88:         if ($status eq 'new') {
   89:             $r->print(
   90:               '<tr bgcolor="#FFBB77"><td><a href="/adm/email?display='.$_.
   91:                   '">Open</a></td><td>'.localtime($sendtime).'</td><td>'.
   92:                   $fromname.'</td><td>'.$fromdomain.'</td><td>'.
   93: 		      &Apache::lonnet::unescape($shortsubj).'</td></tr>');
   94:         }
   95:     }
   96:     $r->print('</table></body></html>');
   97:     return OK;
   98: }
   99: 
  100: 1;
  101: __END__

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