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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sat, 08 Dec 2007 19:19:04 -0000


This is a MIME encoded message

--raeburn1197141544
Content-Type: text/plain

raeburn		Sat Dec  8 14:19:04 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm loncreateuser.pm 
  Log:
  - Row colors in "modify log-in" box alternate correctly in all cases.
  - Default checked radio button in "modify log-in" box stays set to
    "Do not modify log-in" in all cases. 
  
  
--raeburn1197141544
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20071208141904.txt"

Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.622 loncom/interface/loncommon.pm:1.623
--- loncom/interface/loncommon.pm:1.622	Fri Dec  7 19:03:32 2007
+++ loncom/interface/loncommon.pm	Sat Dec  8 14:19:02 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.622 2007/12/08 00:03:32 raeburn Exp $
+# $Id: loncommon.pm,v 1.623 2007/12/08 19:19:02 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1942,6 +1942,11 @@
     if (defined($in{'curr_authtype'})) {
         if ($in{'curr_authtype'} eq 'krb') {
             $krbcheck = ' checked="on"';
+            if (defined($in{'mode'})) {
+                if ($in{'mode'} eq 'modifyuser') {
+                    $krbcheck = '';
+                }
+            }
             if (defined($in{'curr_kerb_ver'})) {
                 if ($in{'curr_krb_ver'} eq '5') {
                     $check5 = ' checked="on"';
@@ -2039,6 +2044,11 @@
         if ($in{'curr_authtype'} eq 'int') {
             if ($can_assign{'int'}) {
                 $intcheck = 'checked="on" ';
+                if (defined($in{'mode'})) {
+                    if ($in{'mode'} eq 'modifyuser') {
+                        $intcheck = '';
+                    }
+                }
                 if (defined($in{'curr_autharg'})) {
                     $intarg = $in{'curr_autharg'};
                 }
@@ -2089,6 +2099,11 @@
         if ($in{'curr_authtype'} eq 'loc') {
             if ($can_assign{'loc'}) {
                 $loccheck = 'checked="on" ';
+                if (defined($in{'mode'})) {
+                    if ($in{'mode'} eq 'modifyuser') {
+                        $loccheck = '';
+                    }
+                }
                 if (defined($in{'curr_autharg'})) {
                     $locarg = $in{'curr_autharg'};
                 }
@@ -2138,6 +2153,11 @@
         if ($in{'curr_authtype'} eq 'fsys') {
             if ($can_assign{'fsys'}) {
                 $fsyscheck = 'checked="on" ';
+                if (defined($in{'mode'})) {
+                    if ($in{'mode'} eq 'modifyuser') {
+                        $fsyscheck = '';
+                    }
+                }
             } else {
                 $result = &mt('Currently Filesystem Authenticated.');
                 return $result;
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.204 loncom/interface/loncreateuser.pm:1.205
--- loncom/interface/loncreateuser.pm:1.204	Fri Dec  7 18:09:30 2007
+++ loncom/interface/loncreateuser.pm	Sat Dec  8 14:19:03 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.204 2007/12/07 23:09:30 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.205 2007/12/08 19:19:03 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -76,7 +76,7 @@
 my $authformloc;
 
 sub initialize_authen_forms {
-    my ($dom,$curr_authtype) = @_; 
+    my ($dom,$curr_authtype,$mode) = @_; 
     my ($krbdefdom)=( $ENV{'SERVER_NAME'}=~/(\w+\.\w+)$/);
     $krbdefdom= uc($krbdefdom);
     my %param = ( formname => 'document.cu',
@@ -91,6 +91,9 @@
         if ($long_auth =~ /^krb(4|5)$/) {
             $param{'curr_kerb_ver'} = $1;
         }
+        if ($mode eq 'modifyuser') {
+            $param{'mode'} = $mode;
+        }
     }
 # no longer static due to configurable kerberos defaults
 #    $loginscript  = &Apache::loncommon::authform_header(%param);
@@ -1197,12 +1200,8 @@
 ENDBADAUTH
         }
     } else { # Authentication type is valid
-        &initialize_authen_forms($ccdomain,$currentauth);
-        my $authformnop_row;      
-        if (&Apache::lonnet::allowed('mau',$ccdomain)) {
-            $authformnop_row = &Apache::loncommon::start_data_table_row();
-        }
-        my ($authformcurrent,$authform_other,$can_modify) =
+        &initialize_authen_forms($ccdomain,$currentauth,'modifyuser');
+        my ($authformcurrent,$can_modify,@authform_others) =
             &modify_login_block($ccdomain,$currentauth);
         if (&Apache::lonnet::allowed('mau',$ccdomain)) {
             # Current user has login modification privileges
@@ -1217,7 +1216,7 @@
                        '</script>'."\n".
                        '<h3>'.$lt{'ld'}.'</h3>'.
                        &Apache::loncommon::start_data_table().
-                       $authformnop_row.
+                       &Apache::loncommon::start_data_table_row().
                        '<td>'.$authformnop;
             if ($can_modify) {
                 $outcome .= '</td>'."\n".
@@ -1229,11 +1228,12 @@
                 $outcome .= '&nbsp;('.$authformcurrent.')</td>'.
                             &Apache::loncommon::end_data_table_row()."\n";
             }
-            if ($authform_other ne '') {
-                $outcome .= $authform_other;
+            foreach my $item (@authform_others) { 
+                $outcome .= &Apache::loncommon::start_data_table_row().
+                            '<td>'.$item.'</td>'.
+                            &Apache::loncommon::end_data_table_row()."\n";
             }
-            $outcome .= &Apache::loncommon::end_data_table_row().
-                        &Apache::loncommon::end_data_table();
+            $outcome .= &Apache::loncommon::end_data_table();
         } else {
             if (&Apache::lonnet::allowed('mau',$env{'request.role.domain'})) {
                 my %lt=&Apache::lonlocal::texthash(
@@ -1256,18 +1256,14 @@
     my %domconfig = &Apache::lonnet::get_dom('configuration',['usercreation'],$dom);
     my ($authnum,%can_assign) =
         &Apache::loncommon::get_assignable_auth($dom);
-    my ($authformcurrent,$authform_other,$show_override_msg);
+    my ($authformcurrent,@authform_others,$show_override_msg);
     if ($currentauth=~/^krb(4|5):/) {
         $authformcurrent=$authformkrb;
         if ($can_assign{'int'}) {
-            $authform_other = &Apache::loncommon::start_data_table_row().
-                              '<td>'.$authformint.'</td>'.
-                              &Apache::loncommon::end_data_table_row()."\n"
+            push(@authform_others,$authformint);
         }
         if ($can_assign{'loc'}) {
-            $authform_other .= &Apache::loncommon::start_data_table_row().
-                               '<td>'.$authformloc.'</td>'.
-                               &Apache::loncommon::end_data_table_row()."\n";
+            push(@authform_others,$authformloc);
         }
         if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) {
             $show_override_msg = 1;
@@ -1275,14 +1271,10 @@
     } elsif ($currentauth=~/^internal:/) {
         $authformcurrent=$authformint;
         if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) {
-            $authform_other = &Apache::loncommon::start_data_table_row().
-                              '<td>'.$authformkrb.'</td>'.
-                              &Apache::loncommon::end_data_table_row()."\n";
+            push(@authform_others,$authformkrb);
         }
         if ($can_assign{'loc'}) {
-            $authform_other .= &Apache::loncommon::start_data_table_row().
-                               '<td>'.$authformloc.'</td>'.
-                               &Apache::loncommon::end_data_table_row()."\n";
+            push(@authform_others,$authformloc);
         }
         if ($can_assign{'int'}) {
             $show_override_msg = 1;
@@ -1290,19 +1282,13 @@
     } elsif ($currentauth=~/^unix:/) {
         $authformcurrent=$authformfsys;
         if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) {
-            $authform_other = &Apache::loncommon::start_data_table_row().
-                              '<td>'.$authformkrb.'</td>'.
-                              &Apache::loncommon::end_data_table_row()."\n";
+            push(@authform_others,$authformkrb);
         }
         if ($can_assign{'int'}) {
-            $authform_other .= &Apache::loncommon::start_data_table_row().
-                               '<td>'.$authformint.'</td>'.
-                               &Apache::loncommon::end_data_table_row()."\n"
+            push(@authform_others,$authformint);
         }
         if ($can_assign{'loc'}) {
-            $authform_other .= &Apache::loncommon::start_data_table_row().
-                               '<td>'.$authformloc.'</td>'.
-                               &Apache::loncommon::end_data_table_row()."\n";
+            push(@authform_others,$authformloc);
         }
         if ($can_assign{'fsys'}) {
             $show_override_msg = 1;
@@ -1310,25 +1296,25 @@
     } elsif ($currentauth=~/^localauth:/) {
         $authformcurrent=$authformloc;
         if (($can_assign{'krb4'}) || ($can_assign{'krb5'})) {
-            $authform_other = &Apache::loncommon::start_data_table_row().
-                              '<td>'.$authformkrb.'</td>'.
-                              &Apache::loncommon::end_data_table_row()."\n";
+            push(@authform_others,$authformkrb);
         }
         if ($can_assign{'int'}) {
-            $authform_other .= &Apache::loncommon::start_data_table_row().
-                               '<td>'.$authformint.'</td>'.
-                               &Apache::loncommon::end_data_table_row()."\n"
+            push(@authform_others,$authformint);
         }
         if ($can_assign{'loc'}) {
             $show_override_msg = 1;
         }
     }
     if ($show_override_msg) {
-        $authformcurrent.= ' <span class="LC_cusr_emph">'.
+        $authformcurrent = '<table><tr><td colspan="3">'.$authformcurrent.
+                           '</td></tr>'."\n".
+                           '<tr><td>&nbsp;&nbsp;&nbsp;</td>'.
+                           '<td><b>'.&mt('Currently in use').'</b></td>'.
+                           '<td align="right"><span class="LC_cusr_emph">'.
                             &mt('will override current values').
-                            '</span><br />';
+                            '</span></td></tr></table>';
     }
-    return ($authformcurrent,$authform_other,$show_override_msg); 
+    return ($authformcurrent,$show_override_msg,@authform_others); 
 }
 
 sub personal_data_display {

--raeburn1197141544--