--- loncom/interface/lonnotify.pm 2005/10/28 19:24:25 1.7
+++ loncom/interface/lonnotify.pm 2012/12/17 15:06:39 1.39
@@ -1,3 +1,7 @@
+# The LearningOnline Network with CAPA
+# Sending messages
+#
+# $Id: lonnotify.pm,v 1.39 2012/12/17 15:06:39 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) = @_;
@@ -53,37 +59,78 @@ sub handler {
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['command']);
my $command = $env{'form.command'};
+ 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 $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
- my $bodytag = &Apache::loncommon::bodytag('Broadcast e-mail to users');
- my $html=&Apache::lonxml::xmlbegin();
+
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/notify',
text=>"Broadcast E-mail"});
if ($command eq 'process') {
- &print_request_receipt($r,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_request_receipt($r,$command,$cdom);
} elsif ($command eq 'compose') {
- &print_composition_form($r,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_composition_form($r,$command,$cdom);
} elsif ($command eq 'pick_target') {
- &print_selection_form($r,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_selection_form($r,$command,$cdom);
} elsif ($command eq 'pick_display') {
- &print_display_option_form($r,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_display_option_form($r,$command,$cdom);
} elsif ($command eq 'display') {
- &print_display($r,$cdom,$tablecolor,$bodytag,$html,\%ltext);
+ &print_display($r,$command,$cdom);
} else {
- &print_front_page($r,$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
+
+