version 1.102, 2007/05/08 17:23:10
|
version 1.107, 2007/07/05 21:37:38
|
Line 562 sub verify_and_change_icons {
|
Line 562 sub verify_and_change_icons {
|
} |
} |
|
|
################################################################ |
################################################################ |
|
# Clicker Subroutines # |
|
################################################################ |
|
|
|
sub clickerchanger { |
|
my $r = shift; |
|
my $user = $env{'user.name'}; |
|
my $domain = $env{'user.domain'}; |
|
my %userenv = &Apache::lonnet::get |
|
('environment',['clickers']); |
|
my $clickers=$userenv{'clickers'}; |
|
$clickers=~s/\,/\n/gs; |
|
my $text=&mt('Enter response device ("clicker") numbers'); |
|
my $change=&mt('Register'); |
|
my $helplink=&Apache::loncommon::help_open_topic('Clicker_Registration', 'Locating your clicker ID'); |
|
$r->print(<<ENDSCREEN); |
|
<form name="prefs" action="/adm/preferences" method="post"> |
|
<input type="hidden" name="action" value="verify_and_change_clicker" /> |
|
<label>$text $helplink<br /> |
|
<textarea name="clickers" rows="5" cols="10">$clickers</textarea> |
|
</label> |
|
<input type="submit" value="$change" /> |
|
</form> |
|
ENDSCREEN |
|
} |
|
|
|
sub verify_and_change_clicker { |
|
my $r = shift; |
|
my $user = $env{'user.name'}; |
|
my $domain = $env{'user.domain'}; |
|
my $newclickers = $env{'form.clickers'}; |
|
$newclickers=~s/\W+/\,/gs; |
|
$newclickers=~tr/a-z/A-Z/; |
|
$newclickers=~s/^\,//; |
|
$newclickers=~s/\,$//; |
|
&Apache::lonnet::put('environment',{'clickers' => $newclickers}); |
|
&Apache::lonnet::appenv('environment.clickers' => $newclickers); |
|
$r->print(&mt('Registering clickers: [_1]',$newclickers)); |
|
} |
|
|
|
################################################################ |
# Message Forward # |
# Message Forward # |
################################################################ |
################################################################ |
|
|
Line 578 sub msgforwardchanger {
|
Line 618 sub msgforwardchanger {
|
foad => 'Forwarding Address(es)', |
foad => 'Forwarding Address(es)', |
mnot => 'Message Notification Email Address(es)', |
mnot => 'Message Notification Email Address(es)', |
chg => 'Change', |
chg => 'Change', |
email => 'The e-mail address you entered', |
email => 'The e-mail address entered in row ', |
notv => 'is not a valid e-mail address', |
notv => 'is not a valid e-mail address', |
toen => "To enter multiple addresses, enter one address at a time, click 'Change' and then add the next one', |
toen => "To enter multiple addresses, enter one address at a time, click 'Change' and then add the next one", |
prme => 'Back to preferences menu', |
prme => 'Back to preferences menu', |
); |
); |
my $forwardingHelp = Apache::loncommon::help_open_topic("Prefs_Forwarding", |
my $forwardingHelp = Apache::loncommon::help_open_topic("Prefs_Forwarding", |
Line 595 sub msgforwardchanger {
|
Line 635 sub msgforwardchanger {
|
my $jscript = qq| |
my $jscript = qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
function validate() { |
function validate() { |
var checkaddress = 0; |
|
for (var i=0; i<document.prefs.numnotify.value; i++) { |
for (var i=0; i<document.prefs.numnotify.value; i++) { |
|
var checkaddress = 0; |
var addr = document.prefs.elements['address_'+i].value; |
var addr = document.prefs.elements['address_'+i].value; |
|
var rownum = i+1; |
if (i < document.prefs.numnotify.value-1) { |
if (i < document.prefs.numnotify.value-1) { |
if (document.prefs.elements['del_notify_'+i].value == false) { |
if (document.prefs.elements['modify_notify_'+i].checked) { |
checkaddress = 1; |
checkaddress = 1; |
} |
} |
} else { |
} else { |
if (document.prefs.elements['add_notify_'+i].checked == true) { |
if (document.prefs.elements['add_notify_'+i].checked == true) { |
checkaddress = 1; |
checkaddress = 1; |
} |
} |
} |
} |
if (checkaddress== 1) { |
if (checkaddress == 1) { |
var addr = document.prefs.elements['address_'+i].value; |
var addr = document.prefs.elements['address_'+i].value; |
if (validmail(document.prefs.elements['address_'+i]) == false) { |
if (validmail(document.prefs.elements['address_'+i]) == false) { |
alert("$lt{'email'}: "+addr+" $lt{'notv'}.\\n($lt{'toen'})."); |
var multimsg = ''; |
|
if (addr.indexOf(",") >= 0) { |
|
multimsg = "\\n($lt{'toen'})."; |
|
} |
|
alert("$lt{'email'} "+rownum+": '"+addr+"' $lt{'notv'}."+multimsg); |
return; |
return; |
} |
} |
} |
} |
} |
} |
document.prefs.submit(); |
document.prefs.submit(); |
} |
} |
|
|
|
function address_changes (adnum) { |
|
if (!document.prefs.elements['del_notify_'+adnum].checked) { |
|
document.prefs.elements['modify_notify_'+adnum].checked = true; |
|
} |
|
} |
|
|
|
function new_address(adnum) { |
|
document.prefs.elements['add_notify_'+adnum].checked = true; |
|
} |
|
|
|
function delete_address(adnum) { |
|
if (document.prefs.elements['del_notify_'+adnum].checked) { |
|
document.prefs.elements['modify_notify_'+adnum].checked = false; |
|
} |
|
} |
|
|
|
function modify_address(adnum) { |
|
if (document.prefs.elements['modify_notify_'+adnum].checked) { |
|
document.prefs.elements['del_notify_'+adnum].checked = false; |
|
} |
|
} |
|
|
$validatescript |
$validatescript |
</script> |
</script> |
|; |
|; |
Line 634 ENDMSG
|
Line 702 ENDMSG
|
my @sortforwards = sort (keys(%allnot)); |
my @sortforwards = sort (keys(%allnot)); |
my $output = &Apache::loncommon::start_data_table(). |
my $output = &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
|
'<th> </th>'. |
'<th>'.&mt('Action').'</th>'. |
'<th>'.&mt('Action').'</th>'. |
'<th>'.&mt('Notification address').'</th><th>'. |
'<th>'.&mt('Notification address').'</th><th>'. |
&mt('Messages to forward').'</th><th>'. |
&mt('Types of message to forward to this address').'</th><th>'. |
&mt('Excerpt retains HTML tags included in message').'</th>'. |
&mt('Excerpt retains HTML tags in message').'</th>'. |
&Apache::loncommon::end_data_table_header_row(); |
&Apache::loncommon::end_data_table_header_row(); |
my $num = 0; |
my $num = 0; |
|
my $counter = 1; |
foreach my $item (@sortforwards) { |
foreach my $item (@sortforwards) { |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= &Apache::loncommon::start_data_table_row(). |
'<td><input type="checkbox" name="del_notify_'.$num.'" />'. |
'<td><b>'.$counter.'</b></td>'. |
&mt('Delete').'</td>'. |
'<td><span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="modify_notify_'. |
|
$num.'" onclick="javscript:modify_address('."'$num'".')" />'. |
|
&mt('Modify').'</label></span> '. |
|
'<span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="del_notify_'.$num. |
|
'" onclick="javscript:delete_address('."'$num'".')" />'. |
|
&mt('Delete').'</label></span></td>'. |
'<td><input type="text" value="'.$item.'" name="address_'. |
'<td><input type="text" value="'.$item.'" name="address_'. |
$num.'" /></td><td>'; |
$num.'" onFocus="javascript:address_changes('."'$num'". |
|
')" /></td><td>'; |
my %chk; |
my %chk; |
if (defined($allnot{$item}{'crit'})) { |
if (defined($allnot{$item}{'crit'})) { |
if (defined($allnot{$item}{'reg'})) { |
if (defined($allnot{$item}{'reg'})) { |
Line 659 ENDMSG
|
Line 737 ENDMSG
|
foreach my $type ('all','crit','reg') { |
foreach my $type ('all','crit','reg') { |
$output .= '<span class="LC_nobreak"><label>'. |
$output .= '<span class="LC_nobreak"><label>'. |
'<input type="radio" name="notify_type_'.$num. |
'<input type="radio" name="notify_type_'.$num. |
'" value="'.$type.'" '.$chk{$type}.'/>'.$lt{$type}.'</label></span> '; |
'" value="'.$type.'" '.$chk{$type}. |
|
' onchange="javascript:address_changes('."'$num'".')" />'. |
|
$lt{$type}.'</label></span> '; |
} |
} |
my $htmlon = ''; |
my $htmlon = ''; |
my $htmloff = ''; |
my $htmloff = ''; |
Line 669 ENDMSG
|
Line 749 ENDMSG
|
$htmloff = 'checked="checked" '; |
$htmloff = 'checked="checked" '; |
} |
} |
$output .= '</td><td><label><input type="radio" name="html_'.$num. |
$output .= '</td><td><label><input type="radio" name="html_'.$num. |
'" value="1" '.$htmlon.'/>'.&mt('Yes').'</label> '. |
'" value="1" '.$htmlon. |
|
' onchange="javascript:address_changes('."'$num'".')" />'. |
|
&mt('Yes').'</label> '. |
'<label><input type="radio" name="html_'.$num.'" value="0" '. |
'<label><input type="radio" name="html_'.$num.'" value="0" '. |
$htmloff.'/>'.&mt('No').'</label></td>'. |
$htmloff. ' onchange="javascript:address_changes('."'$num'". |
|
')" />'. |
|
&mt('No').'</label></td>'. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
$num ++; |
$num ++; |
|
$counter ++; |
} |
} |
my %defchk = ( |
my %defchk = ( |
all => 'checked="checked" ', |
all => 'checked="checked" ', |
Line 681 ENDMSG
|
Line 766 ENDMSG
|
reg => '', |
reg => '', |
); |
); |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= &Apache::loncommon::start_data_table_row(). |
'<td><input type="checkbox" name="add_notify_'.$num.'" />'. |
'<td><b>'.$counter.'</b></td>'. |
&mt('Add').'</td>'. |
'<td><span class="LC_nobreak"><label>'. |
|
'<input type="checkbox" name="add_notify_'.$num. |
|
'" value="1" />'.&mt('Add new address').'</label></span></td>'. |
'<td><input type="text" value="" name="address_'.$num. |
'<td><input type="text" value="" name="address_'.$num. |
'" /></td><td>'; |
'" onFocus="javascript:new_address('."'$num'".')" /></td><td>'; |
foreach my $type ('all','crit','reg') { |
foreach my $type ('all','crit','reg') { |
$output .= '<span class="LC_nobreak"><label>'. |
$output .= '<span class="LC_nobreak"><label>'. |
'<input type="radio" name="notify_type_'.$num. |
'<input type="radio" name="notify_type_'.$num. |
Line 757 sub verify_and_change_msgforward {
|
Line 844 sub verify_and_change_msgforward {
|
my $notification; |
my $notification; |
my $notify_with_html; |
my $notify_with_html; |
my $lastnotify = $env{'form.numnotify'}-1; |
my $lastnotify = $env{'form.numnotify'}-1; |
|
my $totaladdresses = 0; |
for (my $i=0; $i<$env{'form.numnotify'}; $i++) { |
for (my $i=0; $i<$env{'form.numnotify'}; $i++) { |
if ((!defined($env{'form.del_notify_'.$i})) && |
if ((!defined($env{'form.del_notify_'.$i})) && |
((($i==$lastnotify) && (defined($env{'form.add_notify_'.$lastnotify}))) || |
((($i==$lastnotify) && ($env{'form.add_notify_'.$lastnotify} == 1)) || |
($i<$lastnotify))) { |
($i<$lastnotify))) { |
if (defined($env{'form.address_'.$i})) { |
if (defined($env{'form.address_'.$i})) { |
if ($env{'form.notify_type_'.$i} eq 'all') { |
if ($env{'form.notify_type_'.$i} eq 'all') { |
Line 773 sub verify_and_change_msgforward {
|
Line 861 sub verify_and_change_msgforward {
|
if ($env{'form.html_'.$i} eq '1') { |
if ($env{'form.html_'.$i} eq '1') { |
$notify_with_html .= $env{'form.address_'.$i}.','; |
$notify_with_html .= $env{'form.address_'.$i}.','; |
} |
} |
|
$totaladdresses ++; |
} |
} |
} |
} |
} |
} |
Line 798 sub verify_and_change_msgforward {
|
Line 887 sub verify_and_change_msgforward {
|
} else { |
} else { |
&Apache::lonnet::del('environment',['critnotification']); |
&Apache::lonnet::del('environment',['critnotification']); |
&Apache::lonnet::delenv('environment\.critnotification'); |
&Apache::lonnet::delenv('environment\.critnotification'); |
$message.=&mt('Critical message notification set to off').'<br />'; |
$message.=&mt("Critical message notification set to 'off'.").'<br />'; |
} |
} |
if ($critnotification || $notification) { |
if ($critnotification || $notification) { |
if ($notify_with_html) { |
if ($notify_with_html) { |
Line 808 sub verify_and_change_msgforward {
|
Line 897 sub verify_and_change_msgforward {
|
} else { |
} else { |
&Apache::lonnet::del('environment',['notifywithhtml']); |
&Apache::lonnet::del('environment',['notifywithhtml']); |
&Apache::lonnet::delenv('environment\.notifywithhtml'); |
&Apache::lonnet::delenv('environment\.notifywithhtml'); |
$message.=&mt("Set all notification address(es) to receive excerpts with html stripped.").'<br />'; |
if ($totaladdresses == 1) { |
|
$message.=&mt("Set notification address to receive excerpts with html stripped."); |
|
} else { |
|
$message.=&mt("Set all notification addresses to receive excerpts with html stripped."); |
|
} |
} |
} |
} else { |
} else { |
&Apache::lonnet::del('environment',['notifywithhtml']); |
&Apache::lonnet::del('environment',['notifywithhtml']); |
Line 1709 sub handler {
|
Line 1802 sub handler {
|
printmenu => 'yes', |
printmenu => 'yes', |
})); |
})); |
|
|
|
push (@Options,({ action => 'changeclicker', |
|
linktext => 'Register Response Devices ("Clickers")', |
|
href => '/adm/preferences', |
|
subroutine => \&clickerchanger, |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changeicons', |
|
text => 'Register Clicker'}, |
|
}, |
|
{ action => 'verify_and_change_clicker', |
|
subroutine => \&verify_and_change_clicker, |
|
breadcrumb => |
|
{ href => '/adm/preferences?action=changeclicker', |
|
text => 'Register Clicker'}, |
|
printmenu => 'yes', |
|
})); |
|
|
|
|
if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) |
if (&Apache::lonnet::allowed('whn',$env{'request.course.id'}) |
|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' |
|| &Apache::lonnet::allowed('whn',$env{'request.course.id'}.'/' |
.$env{'request.course.sec'})) { |
.$env{'request.course.sec'})) { |