[LON-CAPA-cvs] cvs: loncom /interface lonpopulate.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 28 Jul 2006 01:04:45 -0000


raeburn		Thu Jul 27 21:04:45 2006 EDT

  Modified files:              
    /loncom/interface	lonpopulate.pm 
  Log:
  Some style changes. Wording changes. Javascript added for form verification of notification options page.     
  
  
Index: loncom/interface/lonpopulate.pm
diff -u loncom/interface/lonpopulate.pm:1.44 loncom/interface/lonpopulate.pm:1.45
--- loncom/interface/lonpopulate.pm:1.44	Thu Jul 27 19:24:19 2006
+++ loncom/interface/lonpopulate.pm	Thu Jul 27 21:04:45 2006
@@ -1,5 +1,5 @@
 # automated enrollment configuration handler
-# $Id: lonpopulate.pm,v 1.44 2006/07/27 23:24:19 raeburn Exp $
+# $Id: lonpopulate.pm,v 1.45 2006/07/28 01:04:45 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,7 +46,7 @@
 
 sub choose_header {
     my ($action) = @_;
-
+    my $notify_check = '/^note_[0-9]+$/';
     my $scripttag = qq|
 <script language='javascript' type='text/javascript'>
 <!--
@@ -111,6 +111,34 @@
          checker = 0
      }
  }
+ if (calling == "notify") {
+     var totalnote = 0;
+     if (formName.notify[1].checked = true) {
+         for (var i=0; i<formName.elements.length; i++) {
+             var elementname = formName.elements[i].name;
+             var check_name = elementname.match($notify_check);
+             if (check_name != null) {
+                 if (formName.elements[i].checked) {
+                     totalnote ++;
+                 }
+             } 
+         }
+         if (totalnote > 0) {
+             if (formName.notify[1].checked = true) {
+                 if (confirm("You have indicated that you do not want notification of roster changes messages to be sent, but "+totalnote+" have been checked as recipients.\\nClick 'OK' to erase all recipients, or 'Cancel'.")) {
+                     checker  = 1;
+                 } else {
+                     checker = 0;
+                 }
+             }
+         } else {
+             if (formName.notify[0].checked = true) {
+                 alert("You have indicated that you want notification of roster changes messages to be sent, but you have not selected any recipients.");
+                 checker = 0;
+             }
+         }
+     }
+ }
  if (calling == "viewclass") {
      var totcheck = 0
      var numchk = 0
@@ -494,10 +522,10 @@
           $noteset = "OFF";
       }
       my %dompersonnel = &Apache::lonnet::get_domain_roles($dom,['dc']);
-      foreach my $server (keys %dompersonnel) {
-          foreach my $user (sort(keys %{$dompersonnel{$server}})) {
+      foreach my $server (keys(%dompersonnel)) {
+          foreach my $user (sort(keys(%{$dompersonnel{$server}}))) {
               my ($trole,$uname,$udom,$runame,$rudom,$rsec) = split(/:/,$user);
-              if (!grep/^$uname:$udom$/,@domcoord) {
+              if (!grep(/^$uname:$udom$/,@domcoord)) {
                   push(@domcoord,$uname.':'.$udom);
               }
           }
@@ -546,7 +574,7 @@
               next;
           }
           if ($role eq 'cc')  {
-              unless (grep/^$user$/,@ccs) {
+              unless (grep(/^$user$/,@ccs)) {
                   if ($end && $end < $now) {
                       $status{$user} = 'previous';
                   } elsif ($start > $now) {
@@ -558,7 +586,7 @@
                   my ($uname,$udom) = split(/:/,$user);
                   $pname{$user} = 
                            &Apache::loncommon::plainname($uname,$udom);
-                  if (grep/^$user$/,@notified) {
+                  if (grep(/^$user$/,@notified)) {
                       $notifystate{$user} = 1;
                   } else {
                       $notifystate{$user} = 0;
@@ -566,7 +594,7 @@
               }
           }
       }
-      my $notifyshow = @ccs;
+      my $notifyshow = 0; 
       my %lt = &Apache::lonlocal::texthash(
                                   name => 'Name',
                                   usnm => 'username:domain',
@@ -639,9 +667,15 @@
              </td>
           </tr>");
       }
-      if ($notifycount || @showdom > 0) {
-          $r->print("<tr><td>&nbsp;</td></tr><tr><td>".
-                &mt("Uncheck the 'Notification?' checkbox for each person who is to be removed from the list of recipients who are currently informed of roster changes whenever any adds or drops occur during the nightly enrollment check.").' '.&mt("To include individuals who are not currently recipients, simply check the 'Notification?' checkbox. Click 'Go' to store your changes.")."
+      if (@ccs > 0 || @showdom > 0) {
+          $r->print("<tr><td>&nbsp;</td></tr><tr><td>");
+          if ($notifycount) {
+              $r->print(&mt("Uncheck the checkbox(es) to terminate notification for people currently informed of roster changes from the nightly enrollment update.<br />"));
+         }
+         if ((@ccs + @showdom) > $notifycount) {
+             $r->print(&mt("Check the checkbox(es) to initiate notification for people not currently informed of roster changes from the nightly enrollment update.<br />"));
+         }
+         $r->print(&mt("Click 'Go' to store your changes.")."
            <br/>
            <table width=\"100%\" border=\"0\" cellspadding=\"2\" cellspacing=\"2\">
             <tr>