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

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 09 Nov 2006 22:25:28 -0000


raeburn		Thu Nov  9 17:25:28 2006 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  Elimination of term 'Group' when referring to a non-standard course.  Renaming of form elements when DC assigns a new course role looks up index of relevant form elements based on elements' names instead of using hardcoded numerical offsets. Fix typo in onFocus() call when user clicks in textbox for course name in DC's course level role setter.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.130 loncom/interface/loncreateuser.pm:1.131
--- loncom/interface/loncreateuser.pm:1.130	Wed Aug 16 15:47:42 2006
+++ loncom/interface/loncreateuser.pm	Thu Nov  9 17:25:27 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.130 2006/08/16 19:47:42 albertel Exp $
+# $Id: loncreateuser.pm,v 1.131 2006/11/09 22:25:27 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -313,18 +313,27 @@
                 alert("Section designations do not apply to Course Coordinator roles.\\nA course coordinator role will be added with access to all sections.");
                 section = "";
             }
+            var coursename = "_$dcdom"+"_"+course+"_"+userrole
             var numcourse = getIndex(document.cu.dccourse);
             if (numcourse == "-1") {
                 alert("There was a problem with your course selection");
                 return
             }
-            else { 
-                var coursename = "_$dcdom"+"_"+course+"_"+userrole
-                document.cu.elements[numcourse].name = "act"+coursename
-                document.cu.elements[numcourse+5].name = "sec"+coursename
-                document.cu.elements[numcourse+5].value = section
-                document.cu.elements[numcourse+7].name = "start"+coursename
-                document.cu.elements[numcourse+8].name = "end"+coursename
+            else {
+                document.cu.elements[numcourse].name = "act"+coursename;
+                var numnewsec = getIndex(document.cu.newsec);
+                if (numnewsec != "-1") {
+                    document.cu.elements[numnewsec].name = "sec"+coursename;
+                    document.cu.elements[numnewsec].value = section;
+                }
+                var numstart = getIndex(document.cu.start);
+                if (numstart != "-1") {
+                    document.cu.elements[numstart].name = "start"+coursename;
+                }
+                var numend = getIndex(document.cu.end);
+                if (numend != "-1") {
+                    document.cu.elements[numend].name = "end"+coursename
+                }
             }
         }
         document.cu.submit();
@@ -1503,7 +1512,7 @@
     }
     my %lt=&Apache::lonlocal::texthash(
 		    'prv'  => "Privilege",
-		    'crl'  => "Course/Group Level",
+		    'crl'  => "Course Level",
                     'dml'  => "Domain Level",
                     'ssl'  => "System Level"
 				       );
@@ -1653,7 +1662,7 @@
             'new'  => "Define new section",
             'ssd'  => "Set Start Date",
             'sed'  => "Set End Date",
-            'crl'  => "Course/Group Level",
+            'crl'  => "Course Level",
             'act'  => "Activate",
             'rol'  => "Role",
             'ext'  => "Extent",
@@ -1798,10 +1807,10 @@
     my %customroles=&my_custom_roles();
     my $hiddenitems = '<input type="hidden" name="dcdomain" value="'.$dcdom.'" />'.
                       '<input type="hidden" name="origdom" value="'.$dcdom.'" />'.
-                      '<input type="hidden" name="dccourse" value="" />';
+                      '<input type="hidden" name="dccourse" value="'.$dcdom.'" />';
     my $courseform='<b>'.&Apache::loncommon::selectcourse_link
-            ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course/Group').'</b>';
-    my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom);
+            ('cu','dccourse','dcdomain','coursedesc',undef,undef,'Course').'</b>';
+    my $cb_jscript = &Apache::loncommon::coursebrowser_javascript($dcdom,'currsec','cu');
     my %lt=&Apache::lonlocal::texthash(
                     'typ' => "Type",
                     'rol'  => "Role",
@@ -1813,14 +1822,14 @@
                     'ssd'  => "Set Start Date",
                     'sed'  => "Set End Date"
                   );
-    my $header = '<h4>'.&mt('Course/Group Level').'</h4>'.
+    my $header = '<h4>'.&mt('Course Level').'</h4>'.
                  '<table border="2"><tr><th>'.$lt{'typ'}.'</th><th>'.$courseform.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th></tr>';
     my $otheritems = '<tr><td><select name="crstype" onChange="javascript:setType();">'."\n".
                      ' <option value="">'.&mt('Please select')."\n".
                      ' <option value="Course">'.&mt('Course')."\n".
-                     ' <option value="Group">'.&mt('Group')."\n".
+                     ' <option value="Non-standard course">'.&mt('Non-standard course')."\n".
                      '</select>'."\n".
-                     '<td><input type="text" name="coursedesc" value="" onFocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc','".')" /></td>'."\n".
+                     '<td><input type="text" name="coursedesc" value="" onFocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc',''".')" /></td>'."\n".
                      '<td><select name="role">'."\n";
     foreach  ('st','ta','ep','in','cc') {
         my $plrole=&Apache::lonnet::plaintext($_);