version 1.12, 2006/03/16 20:09:35
|
version 1.16, 2006/04/10 21:40:08
|
Line 58 sub handler {
|
Line 58 sub handler {
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
|
my $function = &Apache::loncommon::get_users_function(); |
my $function = &Apache::loncommon::get_users_function(); |
my $loadcode; |
|
my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg'); |
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); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/notify', |
({href=>'/adm/notify', |
text=>"Broadcast E-mail"}); |
text=>"Broadcast E-mail"}); |
if ($command eq 'process') { |
if ($command eq 'process') { |
&print_request_receipt($r,$command,$cdom,$tablecolor,$bodytag); |
&print_request_receipt($r,$command,$cdom,$tablecolor); |
} elsif ($command eq 'compose') { |
} elsif ($command eq 'compose') { |
&print_composition_form($r,$command,$cdom,$tablecolor,$bodytag); |
&print_composition_form($r,$command,$cdom,$tablecolor); |
} elsif ($command eq 'pick_target') { |
} elsif ($command eq 'pick_target') { |
&print_selection_form($r,$command,$cdom,$tablecolor,$bodytag); |
&print_selection_form($r,$command,$cdom,$tablecolor); |
} elsif ($command eq 'pick_display') { |
} elsif ($command eq 'pick_display') { |
&print_display_option_form($r,$command,$cdom,$tablecolor,$bodytag); |
&print_display_option_form($r,$command,$cdom,$tablecolor); |
} elsif ($command eq 'display') { |
} elsif ($command eq 'display') { |
&print_display($r,$command,$cdom,$tablecolor,$bodytag); |
&print_display($r,$command,$cdom,$tablecolor); |
} else { |
} else { |
&print_front_page($r,'front',$cdom,$tablecolor,$bodytag); |
&print_front_page($r,'front',$cdom,$tablecolor); |
} |
} |
return OK; |
return OK; |
} |
} |
Line 98 sub add_script {
|
Line 85 sub add_script {
|
} |
} |
|
|
sub start_page { |
sub start_page { |
my ($jscript,$bodytag,$bread_title,$formname) = @_; |
my ($jscript,$bread_title,$formname) = @_; |
|
|
my $html = &Apache::lonxml::xmlbegin(); |
|
|
|
my $head = &Apache::loncommon::head('Notification E-mail',$jscript); |
|
|
|
|
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 = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs(undef,$bread_title, |
&Apache::lonhtmlcommon::breadcrumbs(undef,$bread_title, |
'Broadcast_system_email'); |
'Broadcast_system_email'); |
my $output = <<"ENDONE"; |
my $output = <<"ENDONE"; |
$html |
$start_page |
$head |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<br /> |
<br /> |
<form name="$formname" method="POST"> |
<form name="$formname" method="POST"> |
Line 124 sub end_page {
|
Line 126 sub end_page {
|
} |
} |
|
|
sub print_front_page { |
sub print_front_page { |
my ($r,$formname,$cdom,$tablecolor,$bodytag) = @_; |
my ($r,$formname,$cdom,$tablecolor) = @_; |
|
|
my $jscript = qq| |
my $jscript = qq| |
function next_page(caller) { |
function next_page(caller) { |
Line 138 function next_page(caller) {
|
Line 140 function next_page(caller) {
|
} |
} |
|; |
|; |
|
|
my $output = &start_page(&add_script($jscript), $bodytag, |
my $output = &start_page(&add_script($jscript), |
'Broadcast e-mail to Domain', $formname); |
'Broadcast e-mail to Domain', $formname); |
|
|
$output .= '<input type="hidden" name="command" />'; |
$output .= '<input type="hidden" name="command" />'; |
Line 157 function next_page(caller) {
|
Line 159 function next_page(caller) {
|
} |
} |
|
|
sub print_display_option_form { |
sub print_display_option_form { |
my ($r,$formname,$cdom,$tablecolor,$bodytag) = @_; |
my ($r,$formname,$cdom,$tablecolor) = @_; |
&Apache::lonhtmlcommon::add_breadcrumb({text=>"Display options"}); |
&Apache::lonhtmlcommon::add_breadcrumb({text=>"Display options"}); |
|
|
my $table_width = ''; |
my $table_width = ''; |
Line 190 sub print_display_option_form {
|
Line 192 sub print_display_option_form {
|
); |
); |
my $jscript = &Apache::lonhtmlcommon::set_form_elements(\%elements); |
my $jscript = &Apache::lonhtmlcommon::set_form_elements(\%elements); |
|
|
my $output = &start_page(&add_script($jscript), $bodytag, |
my $output = &start_page(&add_script($jscript), |
'Broadcast e-mail display options', $formname); |
'Broadcast e-mail display options', $formname); |
|
|
$output .= &Apache::lonhtmlcommon::start_pick_box($table_width); |
$output .= &Apache::lonhtmlcommon::start_pick_box($table_width); |
Line 218 sub print_display_option_form {
|
Line 220 sub print_display_option_form {
|
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::submit_row($col_width,$tablecolor,&mt('Submit'),$cmd,$submit_text); |
$output .= &Apache::lonhtmlcommon::submit_row($col_width,$tablecolor,&mt('Submit'),$cmd,$submit_text); |
$output .= &Apache::lonhtmlcommon::end_pick_box(); |
$output .= &Apache::lonhtmlcommon::end_pick_box(); |
$output .= qq( |
$output .= qq(<input type="hidden" name="sortby" value="date" />\n). |
<input type="hidden" name="sortby" value="date" /> |
&end_page(); |
</form> |
|
</body> |
|
</html>); |
|
$r->print($output); |
$r->print($output); |
return; |
return; |
} |
} |
|
|
sub print_display { |
sub print_display { |
my ($r,$formname,$cdom,$tablecolor,$bodytag) = @_; |
my ($r,$formname,$cdom,$tablecolor) = @_; |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:goBack('pick_display')", |
({href=>"javascript:goBack('pick_display')", |
text=>"Display options"}, |
text=>"Display options"}, |
Line 259 function goBack(target) {
|
Line 258 function goBack(target) {
|
|
|
ENDSCRIPT |
ENDSCRIPT |
|
|
my $output = &start_page(&add_script($jscript), $bodytag, |
my $output = &start_page(&add_script($jscript), |
'Display Broadcast e-mail', $formname); |
'Display Broadcast e-mail', $formname); |
|
|
foreach my $msgid (keys(%sentmail)) { |
foreach my $msgid (keys(%sentmail)) { |
Line 368 ENDSCRIPT
|
Line 367 ENDSCRIPT
|
$output .= qq(<input type="hidden" name="origin" value="$formname" />\n); |
$output .= qq(<input type="hidden" name="origin" value="$formname" />\n); |
$output .= qq(<input type="hidden" name="command" />\n); |
$output .= qq(<input type="hidden" name="command" />\n); |
$output .= qq(<input type="hidden" name="sortby" value="$curr_sortby" />\n); |
$output .= qq(<input type="hidden" name="sortby" value="$curr_sortby" />\n); |
$output .= qq( |
$output .= &end_page(); |
</form> |
|
</body |
|
</html>); |
|
$r->print($output); |
$r->print($output); |
return; |
return; |
} |
} |
|
|
sub print_selection_form { |
sub print_selection_form { |
my ($r,$formname,$cdom,$tablecolor,$bodytag) = @_; |
my ($r,$formname,$cdom,$tablecolor) = @_; |
my %coursecodes = (); |
my %coursecodes = (); |
my %codes = (); |
my %codes = (); |
my @codetitles = (); |
my @codetitles = (); |
Line 463 function setCourseCat(formname) {
|
Line 459 function setCourseCat(formname) {
|
|
|
|
|
my $output = &start_page(&add_script($jscript).$cb_jscript, |
my $output = &start_page(&add_script($jscript).$cb_jscript, |
$bodytag, 'Choose e-mail audience', $formname); |
'Choose e-mail audience', $formname); |
|
|
$output .= &Apache::lonhtmlcommon::start_pick_box($table_width); |
$output .= &Apache::lonhtmlcommon::start_pick_box($table_width); |
my @roles = ('ow','cc','in','ta','ep','st','cr'); |
my @roles = ('ow','cc','in','ta','ep','st','cr'); |
my %longtypes = (); |
my %longtypes = (); |
my %authtypes = (); |
my %authtypes = (); |
&form_elements(\%longtypes,\%authtypes); |
&form_elements(\%longtypes,\%authtypes); |
my $descrip = $lt{'buil'}.' |
my $descrip = $lt{'buil'}.' |
<ul> |
<ul> |
<li>'.$lt{'kerb'}.'<br />(e.g., MSU.EDU=msu.edu, MSUE.EDU=msue.msu.edu).</li> |
<li>'.$lt{'kerb'}.'<br />(e.g., MSU.EDU=msu.edu, MSUE.EDU=msue.msu.edu).</li> |
<li>'.$lt{'infs'}.'</li> |
<li>'.$lt{'infs'}.'</li> |
</ul>'."\n"; |
</ul>'."\n"; |
my $submit_text = $lt{'comp'}; |
my $submit_text = $lt{'comp'}; |
my $cmd = 'compose'; |
my $cmd = 'compose'; |
$output .= &Apache::lonhtmlcommon::role_select_row(\@roles,$col_width,$tablecolor,'Roles'); |
$output .= &Apache::lonhtmlcommon::role_select_row(\@roles,$col_width,$tablecolor,'Roles'); |
$output .= &Apache::lonhtmlcommon::course_select_row($col_width,$tablecolor,'Courses',$formname,$totcodes,\@codetitles,\%idlist,\%idlist_titles); |
$output .= &Apache::lonhtmlcommon::course_select_row($col_width,$tablecolor,'Courses',$formname,$totcodes,\@codetitles,\%idlist,\%idlist_titles); |
$output .= &Apache::lonhtmlcommon::status_select_row(\%longtypes,$col_width,$tablecolor,&mt('Access status')); |
$output .= &Apache::lonhtmlcommon::status_select_row(\%longtypes,$col_width,$tablecolor,&mt('Access status')); |
$output .= &Apache::lonhtmlcommon::email_default_row(\%authtypes,$col_width,$tablecolor,&mt('Username -> Email conversion'),$descrip); |
$output .= &Apache::lonhtmlcommon::email_default_row(\%authtypes,$col_width,$tablecolor,&mt('Username -> Email conversion'),$descrip); |
$output .= &Apache::lonhtmlcommon::submit_row($col_width,$tablecolor,&mt('Submit'),$cmd,$submit_text); |
$output .= &Apache::lonhtmlcommon::submit_row($col_width,$tablecolor,&mt('Submit'),$cmd,$submit_text); |
$output .= &Apache::lonhtmlcommon::end_pick_box(); |
$output .= &Apache::lonhtmlcommon::end_pick_box(); |
$output .= qq( |
$output .= &end_page(); |
</form> |
|
</body> |
|
</html>); |
|
$r->print($output); |
$r->print($output); |
return; |
return; |
} |
} |
|
|
sub print_composition_form { |
sub print_composition_form { |
my ($r,$formname,$cdom,$tablecolor,$bodytag) = @_; |
my ($r,$formname,$cdom,$tablecolor) = @_; |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:goBack('pick_target')", |
({href=>"javascript:goBack('pick_target')", |
text=>"Select Audience"}, |
text=>"Select Audience"}, |
Line 517 function goBack(target) {
|
Line 510 function goBack(target) {
|
); |
); |
$jscript .= &Apache::lonhtmlcommon::set_form_elements(\%elements); |
$jscript .= &Apache::lonhtmlcommon::set_form_elements(\%elements); |
|
|
$r->print(&start_page(&add_script($jscript), $bodytag, |
$r->print(&start_page(&add_script($jscript), |
'Broadcast e-mail to users', $formname)); |
'Broadcast e-mail to users', $formname)); |
|
|
my $coursefilter = $env{'form.coursepick'}; |
my $coursefilter = $env{'form.coursepick'}; |
Line 659 function goBack(target) {
|
Line 652 function goBack(target) {
|
} |
} |
$output .= '<input type="hidden" name="origin" value="'.$formname.'" />'."\n"; |
$output .= '<input type="hidden" name="origin" value="'.$formname.'" />'."\n"; |
$output .= &Apache::lonhtmlcommon::echo_form_input(['command','origin','subject','message','recipient','sender'],); |
$output .= &Apache::lonhtmlcommon::echo_form_input(['command','origin','subject','message','recipient','sender'],); |
$output .= '</form></body></html>'; |
$output .= &end_page(); |
$r->print($output); |
$r->print($output); |
return; |
return; |
} |
} |
|
|
|
|
sub print_request_receipt { |
sub print_request_receipt { |
my ($r,$formname,$dom,$tablecolor,$bodytag) =@_; |
my ($r,$formname,$dom,$tablecolor) =@_; |
my @recipients = &Apache::loncommon::get_env_multiple('form.recipient'); |
my @recipients = &Apache::loncommon::get_env_multiple('form.recipient'); |
my $subject = $env{'form.subject'}; |
my $subject = $env{'form.subject'}; |
my $message = $env{'form.message'}; |
my $message = $env{'form.message'}; |
Line 689 ENDSCRIPT
|
Line 682 ENDSCRIPT
|
text=>"Outcome"}); |
text=>"Outcome"}); |
|
|
|
|
my $output = &start_page(&add_script($jscript), $bodytag, |
my $output = &start_page(&add_script($jscript), 'E-mail Delivery', |
'E-mail Delivery', $formname); |
$formname); |
|
|
$output .= &Apache::lonhtmlcommon::start_pick_box(); |
$output .= &Apache::lonhtmlcommon::start_pick_box(); |
my @deliveries = (); |
my @deliveries = (); |
Line 728 ENDSCRIPT
|
Line 721 ENDSCRIPT
|
$output .= '<input type="hidden" name="command" />'."\n". |
$output .= '<input type="hidden" name="command" />'."\n". |
'<input type="hidden" name="origin" value="'.$formname.'" />'."\n"; |
'<input type="hidden" name="origin" value="'.$formname.'" />'."\n"; |
$output .= &Apache::lonhtmlcommon::echo_form_input(['command','origin']); |
$output .= &Apache::lonhtmlcommon::echo_form_input(['command','origin']); |
$output .= ' |
$output .= &end_page(); |
</form> |
|
</body> |
|
</html>'; |
|
$r->print($output); |
$r->print($output); |
return; |
return; |
} |
} |