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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Wed, 29 Aug 2007 04:12:34 -0000


This is a MIME encoded message

--raeburn1188360754
Content-Type: text/plain

raeburn		Wed Aug 29 00:12:34 2007 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  - xhtml
  - only display permanentemail in classlist (a student's other e-mail addresses are set privately by student).
  - flush email cache on change
  - add ability to change permanentemail from modify student page
  - CSS in data tables used to display outcome of modification
  
  
--raeburn1188360754
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20070829001234.txt"

Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.167 loncom/interface/londropadd.pm:1.168
--- loncom/interface/londropadd.pm:1.167	Tue Aug 28 09:00:45 2007
+++ loncom/interface/londropadd.pm	Wed Aug 29 00:12:33 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.167 2007/08/28 13:00:45 raeburn Exp $
+# $Id: londropadd.pm,v 1.168 2007/08/29 04:12:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -179,27 +179,27 @@
           { text => 'Create a new group',
             help => 'Course_Create_Group',
             permission => $permission->{'grp_manage'},
-            url => '/adm/coursegroups?refpage=enrl&action=create',
+            url => '/adm/coursegroups?refpage=enrl&action=create',
             },
           { text => 'Modify an existing group',
             help => 'Course_Modify_Group',
             permission => $permission->{'grp_manage'},
-            url => '/adm/coursegroups?refpage=enrl&action=modify',
+            url => '/adm/coursegroups?refpage=enrl&action=modify',
             },
           { text => 'Delete an existing group',
             help => 'Course_Delete_Group',
             permission => $permission->{'grp_manage'},
-            url => '/adm/coursegroups?refpage=enrl&action=delete',
+            url => '/adm/coursegroups?refpage=enrl&action=delete',
             },
           { text => 'Re-enable a deleted group',
             help => 'Course_Reenable_Group',
             permission => $permission->{'grp_manage'},
-            url => '/adm/coursegroups?refpage=enrl&action=reenable',
+            url => '/adm/coursegroups?refpage=enrl&action=reenable',
             },
           { text => 'Enter an existing group',
             help => 'Course_Display_Group',
             permission => $permission->{'grp_view'},
-            url => '/adm/coursegroups?refpage=enrl&action=view',
+            url => '/adm/coursegroups?refpage=enrl&action=view',
             },
           );
     my $menu_html = '';
@@ -1557,12 +1557,8 @@
 
 	my %emails   = &Apache::loncommon::getemails($username,$domain);
 	my $email;
-	foreach my $type ('critnotification', 'permanentemail',
-			  'notification') {
-	    if ($emails{$type} =~ /\S/) {
-		$email = $emails{$type};
-		last;
-	    }
+	if ($emails{'permanentemail'} =~ /\S/) {
+	    $email = $emails{'permanentemail'};
 	}
 
         if ($mode eq 'view' || $mode eq 'html' || $mode eq 'autoenroll') {
@@ -1715,8 +1711,8 @@
     # determine the students name information
     my %info=&Apache::lonnet::get('environment',
                                   ['firstname','middlename',
-                                   'lastname','generation','id'],
-                                  $sdom, $sname);
+                                   'lastname','generation','id',
+                                   'permanentemail'], $sdom, $sname);
     my ($tmp) = keys(%info);
     if ($tmp =~ /^(con_lost|error|no_such_host)/i) {
         $r->print('<font color="#ff0000" size="+2">'.&mt('Error').'</font>'.
@@ -1770,6 +1766,7 @@
                    'mn'    => "Middle",
                    'ln'    => "Last",
                    'gen'   => "Generation",
+                   'email' => "E-mail address",
                    'sid'   => "Student ID",
                    'disn'  => "Disable ID/Student Number Safeguard and Force Change of Conflicting IDs (only do if you know what you are doing)",
                    'sec'   => "Section",
@@ -1799,8 +1796,8 @@
 <input type="hidden" name="state"   value="done" />
 <input type="hidden" name="sortby"  value="$sortby" />
 <input type="hidden" name="Status"  value="$env{'form.Status'}" />
-<h2>$lt{'mef'} $info{'firstname'} $info{'middlename'} 
-$info{'lastname'} $info{'generation'}, $sname:$sdom</h2>
+<h3>$lt{'mef'} $info{'firstname'} $info{'middlename'} 
+$info{'lastname'} $info{'generation'}, $sname:$sdom</h3>
 <p>
 <b>$lt{'sn'}</b>
 <table>
@@ -1812,6 +1809,8 @@
 <input type="text" name="generation" value="$info{'generation'}" /></td></tr>
 </table>
 </p><p>
+<b>$lt{'email'}</b>: <input type="text" name="permanentemail" value="$info{'permanentemail'}" size="30" />
+</p><p>
 <b>$lt{'sid'}</b>: <input type="text" name="id" value="$info{'id'}" size="12" />
 </p><p>
 <label>
@@ -1855,8 +1854,8 @@
     # Get the old data
     my %old=&Apache::lonnet::get('environment',
                                  ['firstname','middlename',
-                                  'lastname','generation','id'],
-                                 $sdom, $slogin);
+                                  'lastname','generation','id',
+                                  'permanentemail'],$sdom, $slogin);
     $old{'section'} = &Apache::lonnet::getsection($sdom,$slogin,
                                                   $env{'request.course.id'});
     my ($tmp) = keys(%old);
@@ -1871,6 +1870,7 @@
     my $middlename = $env{'form.middlename'};
     my $lastname   = $env{'form.lastname'};
     my $generation = $env{'form.generation'};
+    my $permanentemail = $env{'form.permanentemail'};
     my $section    = $env{'form.section'};
     my $courseid   = $env{'request.course.id'};
     my $sid        = $env{'form.id'};
@@ -1895,50 +1895,91 @@
                    'mn'    => "Middle name",
                    'ln'    => "Last name",
                    'gen'   => "Generation",
+                   'em'    => "E-mail address",
                    'sec'   => "Section",
                    'ri'    => "Role Information",
                    'st'    => "Start Time",
                    'et'    => "End Time",
 				       );
     $r->print(<<END);
-    <h2>$lt{'mdu'} $slogin : $sdom </h2>
-<h3>$lt{'si'}</h3>
-<table rules="rows" border="1" cellpadding="3" >
-<tr>
-    <th> $lt{'fd'} </th>
-    <th> $lt{'ov'} </th>
-    <th> $lt{'nv'} </th>
-</tr>
-<tr>
-    <td> <b>$lt{'fn'}</b> </td>
-    <td> $old{'firstname'} </td>
-    <td> $firstname </td>
-</tr><tr>
-    <td> <b>$lt{'mn'}</b> </td>
-    <td> $old{'middlename'} </td>
-    <td> $middlename </td>
-</tr><tr>
-    <td> <b>$lt{'ln'}</b> </td>
-    <td> $old{'lastname'} </td>
-    <td> $lastname </td>
-</tr><tr>
-    <td> <b>$lt{'gen'}</b> </td>
-    <td> $old{'generation'} </td>
-    <td> $generation </td>
-</tr><tr>
-    <td> <b>ID</b> </td>
-    <td> $old{'id'} </td>
-    <td> $sid </td>
-</tr><tr>
-    <td> <b>$lt{'sec'}</b> </td>
-    <td> $old{'section'} </td>
-    <td> $section</td>
-</tr>
-</table>
-<h3>$lt{'ri'}</h3>
+    <h3>$lt{'mdu'} $slogin:$sdom </h3>
+END
+    $r->print(<<END);
 <table>
-<tr><td align="right"><b>$lt{'st'}:</b></td><td> $displayable_starttime </td></tr>
-<tr><td align="right"><b>$lt{'et'}:</b></td><td> $displayable_endtime   </td></tr>
+ <tr>
+  <td>
+    <table class="LC_nested_outer">
+     <tr>
+      <th>$lt{si}</th>
+     </tr>
+     <tr>
+      <td>
+       <table class="LC_nested">
+        <tr class="LC_info_row">
+         <td class="LC_left_item"> $lt{'fd'} </td>
+         <td class="LC_left_item"> $lt{'ov'} </td>
+         <td class="LC_left_item"> $lt{'nv'} </td>
+        </tr>
+        <tr class="LC_odd_row">
+         <td class="LC_left_item"> <b>$lt{'fn'}</b> </td>
+         <td class="LC_left_item"> $old{'firstname'} </td>
+         <td class="LC_left_item"> $firstname </td>
+        </tr>
+        <tr>
+         <td class="LC_left_item"> <b>$lt{'mn'}</b> </td>
+         <td class="LC_left_item"> $old{'middlename'} </td>
+         <td class="LC_left_item"> $middlename </td>
+        </tr>
+        <tr class="LC_odd_row">
+         <td class="LC_left_item"> <b>$lt{'ln'}</b> </td>
+         <td class="LC_left_item"> $old{'lastname'} </td>
+         <td class="LC_left_item"> $lastname </td>
+        </tr>
+        <tr>
+         <td class="LC_left_item"> <b>$lt{'gen'}</b> </td>
+         <td class="LC_left_item"> $old{'generation'} </td>
+         <td class="LC_left_item"> $generation </td>
+        </tr>
+        <tr class="LC_odd_row">
+         <td class="LC_left_item"> <b>ID</b> </td>
+         <td class="LC_left_item"> $old{'id'} </td>
+         <td class="LC_left_item"> $sid </td>
+        </tr>
+        <tr>
+         <td class="LC_left_item"> <b>$lt{'em'}</b> </td>
+         <td class="LC_left_item"> $old{'permanentemail'} </td>
+         <td class="LC_left_item"> $permanentemail </td>
+        <tr class="LC_odd_row">
+         <td> <b>$lt{'sec'}</b> </td>
+         <td> $old{'section'} </td>
+         <td> $section</td>
+        </tr>
+       </table>
+      </td>
+     </tr>
+   </table>
+   <br />
+   <table class="LC_nested_outer">
+     <tr>
+      <th>$lt{'ri'}</th>
+     </tr>
+     <tr>
+      <td>
+       <table class="LC_nested">
+        <tr class="LC_odd_row">
+         <td class="LC_left_item"><b>$lt{'st'}:</b></td>
+         <td class="LC_right_item"> $displayable_starttime </td>
+        </tr>
+        <tr>
+         <td class="LC_left_item"><b>$lt{'et'}:</b></td>
+         <td class="LC_right_item"> $displayable_endtime   </td>
+        </tr>
+       </table>
+      </td>
+     </tr>
+    </table>
+  </td>
+ </tr>
 </table>
 <p>
 END
@@ -1953,7 +1994,11 @@
     }
     my $roleresults = &Apache::lonnet::modifystudent
         ($sdom,$slogin,$sid,undef,undef,$firstname,$middlename,$lastname,
-         $generation,$section,$endtime,$starttime,$env{'form.forceid'});
+         $generation,$section,$endtime,$starttime,$env{'form.forceid'},
+         undef,$permanentemail);
+    if ($old{'permanentemail'} ne $permanentemail) {
+        &Apache::loncommon::flush_email_cache($slogin,$sdom);
+    }
     if ($roleresults eq 'refused' ) {
         $r->print(&mt('Your request to change the role information for this student was refused. You do not appear to have sufficient authority to change student information.'));
     } elsif ($roleresults !~ /ok/) {

--raeburn1188360754--