--- loncom/interface/loncommunicate.pm 2005/04/07 06:56:23 1.28 +++ loncom/interface/loncommunicate.pm 2009/07/25 23:16:04 1.46 @@ -1,7 +1,7 @@ # The LearningOnline Network # Communicate # -# $Id: loncommunicate.pm,v 1.28 2005/04/07 06:56:23 albertel Exp $ +# $Id: loncommunicate.pm,v 1.46 2009/07/25 23:16:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -31,59 +31,86 @@ package Apache::loncommunicate; use strict; use Apache::Constants qw(:common); -use Apache::lonmsg(); +use Apache::lonmsgdisplay(); use Apache::loncommon; use Apache::lonlocal; use Apache::lonnet; sub menu { my $r=shift; - my %lt=&Apache::lonlocal::texthash( -'mnf' => 'Make New Folder', -'vcm' => 'View Critical Messages', -'smu' => 'Send Message to User(s)', -'bmc' => 'Broadcast Message to Course', -'dmu' => 'Distribute Messages from Uploaded File to Course', -'unr' => - 'User Notes, Records of Face-to-Face Discussions, and Critical Messages', - -'cbs' => 'Configure blocking of student communication during exams' - -); - my %help=(); - foreach ('Course_Face_To_Face_Records,Course_Critical_Message', - 'Course_Broadcast_Message') { - $help{$_}=&Apache::loncommon::help_open_topic($_); + my $crstype = 'course'; + my $usertype = 'student'; + if (defined($env{'course.'.$env{'request.course.id'}.'.type'})) { + $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}; + if ($crstype eq 'Community') { + $usertype = 'member'; + } } + + # ------------------------------------------------------------------------ Menu - $r->print(< -
- - -
- - $lt{'smu'} - -END - if (($env{'request.course.id'}) && - (&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) { - $r->print(< - $lt{'bmc'}$help{'Course_Broadcast_Message'} - - - $lt{'dmu'} - - -$lt{'unr'}$help{'Course_Face_To_Face_Records,Course_Critical_Message'} - - - $lt{'cbs'} - -END - } - $r->print(''); + my ($can_srm,$can_dcm,$can_dff); + if ($env{'request.course.id'}) { + if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) || + (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'. + $env{'request.course.sec'}))) { + $can_srm = 1; + } + if ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) || + (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.'/'. + $env{'request.course.sec'}))) { + $can_dcm = 1; + } + if ((&Apache::lonnet::allowed('dff',$env{'request.course.id'})) || + (&Apache::lonnet::allowed('dff',$env{'request.course.id'}.'/'. + $env{'request.course.sec'}))) { + $can_dff = 1; + } + } + + my @reports = ( + {categorytitle => 'Send Messages', + items => [ + {url => '/adm/email?compose=individual', + permission => 'F', + icon => 'mail-message-new.png', + linktext => 'New Message', + linktitle => 'Send a message to users.'}, + + {url => '/adm/email?compose=group', + permission => "$can_srm", + icon => 'mail-reply-all.png', + linktext => 'New Broadcast Message', + help => 'Course_Broadcast_Message', + linktitle => "Send a broadcast message to members of this $crstype and/or other users."}, + + {url => '/adm/email?compose=upload', + permission => "$can_srm", + icon => 'fromfile.png', + linktext => 'New Messages from File', + linktitle => 'Create a message from file and send to users.'}, + ]}, + ); + + if ($can_dff || $can_dcm ){ + push(@reports,{categorytitle => 'Message Administration', + items => [ + {url => '/adm/email?recordftf=query', + permission => "$can_dff", + icon => 'messalog.png', + linktext => 'Message Log for Selected Users', + help => 'Course_Face_To_Face_Records,Course_Critical_Message', + linktitle => "User notes, records of face-to-face discussions, critical messages, broadcast messages and archived messages in $crstype."}, + + {url => '/adm/email?block=display', + permission => "$can_dcm", + icon => 'comblock.png', + linktext => 'Communication Blocking', + linktitle => "Blocking of $usertype communication during exams."}, + ]}); + } +$r->print(&Apache::lonhtmlcommon::generate_menu(@reports)); + } sub handler { @@ -94,13 +121,6 @@ sub handler { # # Start document # - my $html=&Apache::lonxml::xmlbegin(); - $r->print(< -The LearningOnline Network with CAPA - -END # ----------------------------------------------------------------- Breadcrumbs &Apache::lonhtmlcommon::clear_breadcrumbs(); @@ -110,9 +130,10 @@ END faq=>12,bug=>'Communication Tools',}); # ---------------------------------------------------------------------- Header - &Apache::lonmsg::header($r); + &Apache::lonmsgdisplay::header($r); &menu($r); - &Apache::lonmsg::disall($r,'new'); + &Apache::lonmsgdisplay::disall($r); + $r->print(&Apache::loncommon::end_page()); return OK; }