[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface lonuserutils.pm

raeburn raeburn@source.lon-capa.org
Mon, 08 Nov 2010 21:11:14 -0000


This is a MIME encoded message

--raeburn1289250674
Content-Type: text/plain

raeburn		Mon Nov  8 21:11:14 2010 EDT

  Modified files:              (Branch: GCI_3)
    /loncom/interface	lonuserutils.pm 
  Log:
  - Customization for GCI_3.
    - form element caller renamed context.
    - javascript check of field associations modified as password field
      moved to second item in options list.
  
  
--raeburn1289250674
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20101108211114.txt"

Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.109.2.6 loncom/interface/lonuserutils.pm:1.109.2.7
--- loncom/interface/lonuserutils.pm:1.109.2.6	Mon Nov  8 21:08:27 2010
+++ loncom/interface/lonuserutils.pm	Mon Nov  8 21:11:14 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.109.2.6 2010/11/08 21:08:27 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.109.2.7 2010/11/08 21:11:14 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -330,7 +330,7 @@
     my ($sectionjs,$groupslist);
     if ($context eq 'course') {
         $groupslist = &get_groupslist();
-        if ($env{'form.caller'} eq 'requestcrs') {
+        if ($env{'form.context'} eq 'requestcrs') {
             $sectionjs = <<"ENDJS";
 
 function toggleSectionsDefault() {
@@ -375,7 +375,7 @@
               &hidden_input('fileupload',$env{'form.fileupload'}).
               &hidden_input('upfiletype',$env{'form.upfiletype'}).
               &hidden_input('upfile_associate',$env{'form.upfile_associate'}).
-              &hidden_input('caller',$env{'form.caller'}));
+              &hidden_input('context',$env{'form.context'}));
     $r->print('<br /><label><input type="checkbox" name="noFirstLine"'.$checked.' />'.
               &mt('Ignore First Line').'</label><br />');
     $r->print('<br /><input type="button" value="'.&mt('Reverse Association').'" '.
@@ -415,7 +415,7 @@
             if ($context eq 'course') {
                 if ($env{'request.course.sec'} eq '') {
                     $setsection_call = 'setSections(document.'.$param{'formname'}.",'$crstype'".');';
-                    if ($env{'form.caller'} eq 'requestcrs') {
+                    if ($env{'form.context'} eq 'requestcrs') {
                         $setsections_js =  &newsections_javascript($param{'formname'});
                     } else {
                         $setsections_js =
@@ -550,7 +550,7 @@
     } else {
         $section_checks = &section_check_js();
 
-        unless ($env{'form.caller'} eq 'requestcrs') {
+        unless ($env{'form.context'} eq 'requestcrs') {
             $optional_checks = (<<END);
     var message='';
     if (foundname==0) {
@@ -598,7 +598,7 @@
     }
 END
         }
-        if ($env{'form.caller'} eq 'requestcrs') {
+        if ($env{'form.context'} eq 'requestcrs') {
             $optional_checks .= (<<END);
     vf.state.value='enrolling';
     $finish
@@ -688,14 +688,14 @@
 //
 // 0 = none
 // 1 = username
-// 2 = names (lastname, firstnames)
-// 3 = fname (firstname)
-// 4 = mname (middlename)
-// 5 = lname (lastname)
-// 6 = gen   (generation)
-// 7 = id
-// 8 = section
-// 9 = ipwd  (password)
+// 2 = ipwd  (password)
+// 3 = names (lastname, firstnames)
+// 4 = fname (firstname)
+// 5 = mname (middlename)
+// 6 = lname (lastname)
+// 7 = gen   (generation)
+// 8 = id
+// 9 = section
 // 10 = email address
 // 11 = role
 // 12 = domain
@@ -711,20 +711,20 @@
       }
    }
    // If we set this to 'lastname, firstnames', clear out all the ones
-   // set to 'fname','mname','lname','gen' (3,4,5,6) currently.
-   if (nw==2) {
+   // set to 'fname','mname','lname','gen' (4,5,6,7) currently.
+   if (nw==3) {
       for (i=0;i<=vf.nfields.value;i++) {
-         if ((eval('vf.f'+i+'.selectedIndex')>=3) &&
-             (eval('vf.f'+i+'.selectedIndex')<=6)) {
+         if ((eval('vf.f'+i+'.selectedIndex')>=4) &&
+             (eval('vf.f'+i+'.selectedIndex')<=7)) {
              eval('vf.f'+i+'.selectedIndex=0;')
          }
       }
    }
-   // If we set this to one of 'fname','mname','lname','gen' (3,4,5,6),
-   // clear out any that are set to 'lastname, firstnames' (2)
-   if ((nw>=3) && (nw<=6)) {
+   // If we set this to one of 'fname','mname','lname','gen' (4,5,6,7),
+   // clear out any that are set to 'lastname, firstnames' (3)
+   if ((nw>=4) && (nw<=7)) {
       for (i=0;i<=vf.nfields.value;i++) {
-         if (eval('vf.f'+i+'.selectedIndex')==2) {
+         if (eval('vf.f'+i+'.selectedIndex')==3) {
              eval('vf.f'+i+'.selectedIndex=0;')
          }
       }
@@ -735,7 +735,7 @@
 function clearpwd(vf) {
     var i;
     for (i=0;i<=vf.nfields.value;i++) {
-        if (eval('vf.f'+i+'.selectedIndex')==9) {
+        if (eval('vf.f'+i+'.selectedIndex')==2) {
             eval('vf.f'+i+'.selectedIndex=0;')
         }
     }
@@ -838,8 +838,8 @@
         $env{'form.ipwd_choice'} ne '') {
         $param{'curr_authtype'} = 'int';
     }
-    if ($env{'form.caller'} eq 'requestcrs') {
-        $param{'caller'} = $env{'form.caller'};
+    if ($env{'form.context'} eq 'requestcrs') {
+        $param{'context'} = $env{'form.context'};
     }
     my $krbform = &Apache::loncommon::authform_kerberos(%param);
     my $intform = &Apache::loncommon::authform_internal(%param);
@@ -853,7 +853,7 @@
 
     $Str .= '<h3>'.&mt('Options').'</h3>'
            .&Apache::lonhtmlcommon::start_pick_box();
-    if ($env{'form.caller'} eq 'requestcrs') {
+    if ($env{'form.context'} eq 'requestcrs') {
         $Str .= &Apache::lonhtmlcommon::row_title(&mt('Default password'));
     } else {
         $Str .= &Apache::lonhtmlcommon::row_title(&mt('Login Type'));
@@ -879,7 +879,7 @@
             $Str .= "</p>\n";
     }
     $Str .= &set_login($defdom,$krbform,$intform,$locform);
-    if ($env{'form.caller'} eq 'requestcrs') {
+    if ($env{'form.context'} eq 'requestcrs') {
         $Str .= '<input type="hidden" name="defaultdomain" value="gcitest" />';
     }
     my ($home_server_pick,$numlib) =
@@ -897,7 +897,7 @@
                 &Apache::lonhtmlcommon::row_closure();
     }
 
-    unless ($env{'form.caller'} eq 'requestcrs') {
+    unless ($env{'form.context'} eq 'requestcrs') {
         $Str .= &Apache::lonhtmlcommon::row_title(&mt('Default domain'))
                .&Apache::loncommon::select_dom_form($defdom,'defaultdomain',undef,1)
                .&Apache::lonhtmlcommon::row_closure()
@@ -924,7 +924,7 @@
                     &mt('Default role'))
                .&mt('Choose the role to assign to users without a value specified in the uploaded file.')
     } elsif ($context eq 'course') {
-        if ($env{'form.caller'} eq 'requestcrs') {
+        if ($env{'form.context'} eq 'requestcrs') {
             $Str .= &Apache::lonhtmlcommon::row_title(&mt('Default section')).
                     &mt('Students can be assigned to different sections.').'<br />'.
                     &mt('Will you be using sections?').'&nbsp;'.
@@ -964,7 +964,7 @@
     } else {
         my ($cnum,$cdom) = &get_course_identity();
         my ($rowtitle,$closure);
-        if ($env{'form.caller'} eq 'requestcrs') {
+        if ($env{'form.context'} eq 'requestcrs') {
             $closure = 1;
             $rowtitle = &mt('default section name (letters/numbers only)');
         } else {
@@ -972,9 +972,9 @@
         }
         my $secbox = &section_picker($cdom,$cnum,'Any',$rowtitle,
                                     $permission,$context,'upload',$crstype,
-                                    $env{'form.caller'}).
+                                    $env{'form.context'}).
                      &Apache::lonhtmlcommon::row_closure($closure);
-        if ($env{'form.caller'} eq 'requestcrs') {
+        if ($env{'form.context'} eq 'requestcrs') {
             $Str .= '<div id ="defaultsec" style="display: none" />'.$secbox.'</div>';
         } else {
             $Str .= $secbox; 
@@ -991,7 +991,7 @@
                     stus => 'Students selected from this list can be dropped.'
             );
         }
-        unless ($env{'form.caller'} eq 'requestcrs') {
+        unless ($env{'form.context'} eq 'requestcrs') {
             $Str .= &Apache::lonhtmlcommon::row_title(&mt('Full Update'))
                    .'<label><input type="checkbox" name="fullup" value="yes" />'
                    .' '.$lt{'disp'}
@@ -1001,7 +1001,7 @@
         }
     }
     if ($context eq 'course' || $context eq 'domain') {
-        unless ($env{'form.caller'} eq 'requestcrs') {
+        unless ($env{'form.context'} eq 'requestcrs') {
             $Str .= &forceid_change($context);
         }
     }
@@ -3910,7 +3910,7 @@
            .&Apache::lonhtmlcommon::end_pick_box();
 
     $str .= '<p>'
-           .'<input type="hidden" name=caller" value="'.$caller.'" />' 
+           .'<input type="hidden" name="context" value="'.$caller.'" />' 
            .'<input type="submit" name="fileupload" value="'.&mt('Next').'" />'
            .'</p>';
 
@@ -3935,7 +3935,7 @@
             $fields{$env{'form.f'.$i}}=$keyfields[$i];
         }
     }
-    if ($env{'form.fullup'} ne 'yes') {
+    if (($env{'form.fullup'} ne 'yes') && ($env{'form.context'} ne 'requestcrs')) {
         $r->print('<form name="studentform" method="post" action="/adm/createuser">'."\n".
                   '<input type="hidden" name="action" value="'.$env{'form.action'}.'" />');
     }
@@ -3974,7 +3974,7 @@
         }
     }
     my ($startdate,$enddate);
-    if ($env{'form.caller'} eq 'requestcrs') {
+    if ($env{'form.context'} eq 'requestcrs') {
         $startdate = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_start_date'};
         $enddate = $env{'course.'.$env{'request.course.id'}.'.default_enrollment_end_date'};
     } else {

--raeburn1289250674--