--- loncom/interface/lonnotify.pm 2005/12/09 00:08:35 1.9
+++ loncom/interface/lonnotify.pm 2021/03/06 13:41:46 1.44
@@ -1,3 +1,7 @@
+# The LearningOnline Network with CAPA
+# Sending messages
+#
+# $Id: lonnotify.pm,v 1.44 2021/03/06 13:41:46 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,13 +31,15 @@ package Apache::lonnotify;
use strict;
use Apache::lonnet;
use Apache::loncommon;
-use Apache::lonsupportreq;
+use Apache::courseclassifier;
use LONCAPA::Enrollment;
use Apache::Constants qw(:common :http);
use Apache::lonlocal;
use Mail::Send;
use HTML::TokeParser;
use HTML::Entities;
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
sub handler {
my ($r) = @_;
@@ -56,49 +62,75 @@ sub handler {
my $origin = $env{'form.origin'};
&Apache::lonhtmlcommon::clear_breadcrumbs();
- my %ltext=&Apache::lonlocal::texthash(
- 'note' => 'Notification E-mail',
- );
- my $function = &Apache::loncommon::get_users_function();
- my $loadcode;
- my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
- if ((defined($env{'form.origin'})) && ($command eq 'compose' || $command eq 'pick_target' || $command eq 'pick_display')) {
- unless ($env{'form.origin'} eq '') {
- $loadcode = 'javascript:setFormElements(document.'.$env{'form.command'}.')';
- if (($command eq 'pick_target') && (
- ($origin eq 'compose') || ($origin eq 'process'))) {
- if ($env{'form.coursepick'} eq 'category') {
- $loadcode .= ';javascript:setCourseCat(document.'.$env{'form.command'}.')';
- }
- }
- }
- }
- my $loaditems = ' onLoad="'.$loadcode.'" ';
- my $bodytag = &Apache::loncommon::bodytag('Broadcast e-mail to users',$function,$loaditems);
- my $html=&Apache::lonxml::xmlbegin();
+
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/notify',
text=>"Broadcast E-mail"});
if ($command eq 'process') {
- &print_request_receipt($r,$command,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_request_receipt($r,$command,$cdom);
} elsif ($command eq 'compose') {
- &print_composition_form($r,$command,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_composition_form($r,$command,$cdom);
} elsif ($command eq 'pick_target') {
- &print_selection_form($r,$command,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_selection_form($r,$command,$cdom);
} elsif ($command eq 'pick_display') {
- &print_display_option_form($r,$command,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_display_option_form($r,$command,$cdom);
} elsif ($command eq 'display') {
- &print_display($r,$command,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_display($r,$command,$cdom);
} else {
- &print_front_page($r,'front',$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_front_page($r,'front',$cdom);
}
return OK;
}
+sub add_script {
+ my ($js) = @_;
+ return '';
+}
+
+sub start_page {
+ my ($jscript,$bread_title,$formname) = @_;
+
+ my $loadcode;
+ if ((defined($env{'form.origin'}))
+ && ($env{'form.command'} eq 'compose'
+ || $env{'form.command'} eq 'pick_target'
+ || $env{'form.command'} eq 'pick_display')) {
+ if ($env{'form.origin'} ne '') {
+ $loadcode = 'javascript:setFormElements(document.'.$env{'form.command'}.')';
+ if (($env{'form.command'} eq 'pick_target')
+ && (($env{'form.origin'} eq 'compose')
+ || ($env{'form.origin'} eq 'process'))) {
+ if ($env{'form.coursepick'} eq 'category') {
+ $loadcode .= ';javascript:setCourseCat(document.'.$env{'form.command'}.')';
+ }
+ }
+ }
+ }
+
+ my $start_page =
+ &Apache::loncommon::start_page('Broadcast e-mail to users', $jscript,
+ {'add_entries' =>
+ {'onload' => $loadcode,},});
+ my $breadcrumbs =
+ &Apache::lonhtmlcommon::breadcrumbs($bread_title,
+ 'Broadcast_system_email');
+ my $output = <<"ENDONE";
+$start_page
+$breadcrumbs
+
+