Diff for /loncom/interface/lonpreferences.pm between versions 1.103 and 1.104

version 1.103, 2007/05/08 18:26:54 version 1.104, 2007/05/13 22:04:06
Line 578  sub msgforwardchanger { Line 578  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',
Line 595  sub msgforwardchanger { Line 595  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 662  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>&nbsp;</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>&nbsp;&nbsp; '.
                      '<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 697  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>&nbsp;';                         '" value="'.$type.'" '.$chk{$type}.
                          ' onchange="javascript:address_changes('."'$num'".')" />'.
                          $lt{$type}.'</label></span>&nbsp;';
         }          }
         my $htmlon = '';          my $htmlon = '';
         my $htmloff = '';          my $htmloff = '';
Line 669  ENDMSG Line 709  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>&nbsp;'.                     '" value="1" '.$htmlon.
                      ' onchange="javascript:address_changes('."'$num'".')" />'.
                      &mt('Yes').'</label>&nbsp;'.
                    '<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 726  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 804  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 821  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 847  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 857  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']);

Removed from v.1.103  
changed lines
  Added in v.1.104


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>