[LON-CAPA-cvs] cvs: modules /raeburn loncreatecourse.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Tue, 02 Dec 2003 00:24:16 -0000


This is a MIME encoded message

--raeburn1070324656
Content-Type: text/plain

raeburn		Mon Dec  1 19:24:16 2003 EDT

  Modified files:              
    /modules/raeburn	loncreatecourse.pm 
  Log:
  12/1/2003 version of loncreatecourse.pm used by the domain coordinator to create new courses. Changes include several course parameters, all prefixed by internal. that store information about courseID mapping to institutional data, as well as settings for automated enrollment process.  Once a course has been set up, most of these settings can be modified by a course coordinator via routines in Apache::lonpopulate   SPR 12/1/2003
  
  
--raeburn1070324656
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20031201192416.txt"

Index: modules/raeburn/loncreatecourse.pm
diff -u modules/raeburn/loncreatecourse.pm:1.1 modules/raeburn/loncreatecourse.pm:1.2
--- modules/raeburn/loncreatecourse.pm:1.1	Thu Nov 13 11:11:10 2003
+++ modules/raeburn/loncreatecourse.pm	Mon Dec  1 19:24:16 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.1 2003/11/13 16:11:10 raeburn Exp $
+# $Id: loncreatecourse.pm,v 1.2 2003/12/02 00:24:16 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -68,6 +68,17 @@
     my $bodytag=&Apache::loncommon::bodytag('Create a New Course');
     my $helplink=&Apache::loncommon::help_open_topic('Create_Course','Help on Creating Courses');
     my $date_table = &date_setting_table();
+    my ($krbdef,$krbdefdom) =
+    &Apache::loncommon::get_kerberos_defaults($defdom);
+    my $javascript_validations=&javascript_validations($krbdefdom);
+    my %param = ( formname => 'document.ccrs',
+                   kerb_def_dom => $krbdefdom,
+                   kerb_def_auth => $krbdef
+                );
+    my $krbform = &Apache::loncommon::authform_kerberos(%param);
+    my $intform = &Apache::loncommon::authform_internal(%param);
+    my $locform = &Apache::loncommon::authform_local(%param);
+
     $r->print(<<ENDDOCUMENT);
 <html>
 <script language="JavaScript" type="text/javascript">
@@ -88,6 +99,7 @@
     editbrowser = open(url,title,options,'1');
     editbrowser.focus();
 }
+$javascript_validations
 </script>
 <head>
 <title>The LearningOnline Network with CAPA</title>
@@ -110,48 +122,48 @@
 The following entries will be used to identify the course according to the naming scheme adopted by your institution. Your choices will be used to map an internal LON-CAPA course ID to the corresponding course section ID(s) used by the office responsible for providing official class lists for courses at your institution. This mapping is required if you choose to employ automatic population of class lists.  
 </p><p>          
 <b>Course Code</b> 
-<input type="text" size="30" name="crscode"><br>
+<input type="text" size="30" name="crscode" /><br/>
 (to interface with institutional data, e.g., fs03glg231 for Fall 2003 Geology 231)
 </p><p>
-<b>Section Numbers</b>
- <input type="text" size="30" name="crssections"><br>
-(a comma separated list of section numbers, e.g., 001,002)
+<b>Section Numbers and corresponding LON-CAPA section/group IDs</b>
+ <input type="text" size="30" name="crssections" /><br/>
+(a comma separated list of institutional section numbers, each separated by a colon from the (optional) corresponding section/group ID to be used in LON-CAPA e.g., 001:1,002:2)
 </p><p>
 <b>Crosslisted courses</b>
- <input type="text" size="30" name="crsxlists"><br>
-(a comma separated list of course sections crosslisted with the current course, e.g., fs03ent231001, fs03bot231001, fs03zol231002)
+<input type="text" size="30" name="crsxlist" /><br/>
+(a comma separated list of course sections crosslisted with the current course, with each entry including the institutional course section name followed by a colon and then the (optional) groupID to be used in LON-CAPA, e.g., fs03ent231001:ent1,fs03bot231001:bot1,fs03zol231002:bot2)
 </p><p>  
 <h2>Course Content</h2>
 <p>
 <b>Map:</b>
-<input type="text" size="50" name="topmap">
+<input type="text" size="50" name="topmap" />
 <a href="javascript:openbrowser('ccrs','topmap')">Select Map</a>
 </p><p>
 <b>Do NOT generate as standard course</b> 
 (only check if you know what you are doing):
-<input type="checkbox" name="nonstandard">
+<input type="checkbox" name="nonstandard" />
 </p>
 <p>
 <b>First Resource</b> (standard courses only):
-<input type="radio" name="firstres" value="blank">Blank
+<input type="radio" name="firstres" value="blank" />Blank
 &nbsp;
-<input type="radio" name="firstres" value="syl" checked>Syllabus
+<input type="radio" name="firstres" value="syl" checked="true" />Syllabus
 &nbsp;
-<input type="radio" name="firstres" value="nav">Navigate
+<input type="radio" name="firstres" value="nav" />Navigate
 </p>
 
 <h2>Assessment Parameters</h2>
 <p>
 <b>Open all assessments: </b>
-<input type="checkbox" name="openall" checked>
+<input type="checkbox" name="openall" checked="true" />
 </p>
 <h2>Messaging</h2>
 <p>
 <b>Set course policy feedback to Course Coordinator: </b>
-<input type="checkbox" name="setpolicy" checked>
+<input type="checkbox" name="setpolicy" checked="true" />
 </p><p>
 <b>Set content feedback to Course Coordinator: </b>
-<input type="checkbox" name="setcontent" checked>
+<input type="checkbox" name="setcontent" checked="true" />
 </p>
 <h2>Communication</h2>
 <p>
@@ -172,33 +184,93 @@
 <b>Domain:</b> $domform
 </p><p>
 <b>Immediately expire own role as Course Coordinator:</b>
-<input type="checkbox" name="expireown" checked>
+<input type="checkbox" name="expireown" checked="true" />
 </p><p>
 <h2>Automated enrollment settings</h2>
 The following settings control automatic enrollment of students in this class based on information available for this specific course from your institution's official classlists.
 </p>
 <p>
 <b>Automated adds</b>
-<input type="radio" name="autoadds" value="1">Yes <input type="radio" name="autoadds" value="0" >No
+<input type="radio" name="autoadds" value="1" checked="true" />Yes <input type="radio" name="autoadds" value="0" />No
 </p><p>
 <b>Automated drops</b>
-<input type="radio" name="autodrops" value="1">Yes <input type="radio" name="autodrops" value="0" >No
+<input type="radio" name="autodrops" value="1" checked="true" />Yes <input type="radio" name="autodrops" value="0" />No
 </p><p>
 <b>Duration of automated classlist updates</b>
 $date_table
 </p><p>
+<b>Please select the authentication mechanism.</b><br />
+Please choose the default authentication method to be used by new users added to this LON-CAPA domain by the automated enrollment process.
+</p><p>
+$krbform
+<br />
+$intform
+<br />
+$locform
+</p>
+
+<b>Notification of enrollment changes</b><br />
+Notification to course coordinator via LON-CAPA message when enrollment changes occur during the automated update?<br/>
+<input type="radio" name="notify" value="1" />Yes <input type="radio" name="notify" value="0" />No 
+</p><p>
+<b>Include retrieval of student photographs?</b> <input type="radio" name="showphotos" value="1" />Yes <input type="radio" name="showphotos" value="0" checked="true" />No
+</p><p>
 <input type="hidden" name="phase" value="two" />
-<input type="submit" value="Open Course">
+<input type="submit" value="Open Course" />
 </p><p>
-<b>Email notification of enrollment changes</b>
-Email notification to course coordinator when enrollment changes occur during the automated update? 
-<input type="checkbox" name="notifyemail">   
 </form>
 </body>
 </html>
 ENDDOCUMENT
 }
 
+sub javascript_validations {
+    my ($krbdefdom)=@_;
+    my %param = ( formname => 'ccrs',
+                  kerb_def_dom => $krbdefdom );
+    my $authheader = &Apache::loncommon::authform_header(%param);
+    my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
+    return (<<ENDPICK);
+function verify_message (vf,foundpwd) {
+    var foundatype=0;
+    var message='';
+    // alert('current.radiovalue = '+current.radiovalue);
+    if (current.radiovalue == null || current.radiovalue == 'nochange') {
+        // They did not check any of the login radiobuttons.
+        alert('You must choose an authentication type');
+        return;
+    }
+    foundatype=1;
+    if (current.argfield == null || current.argfield == '') {
+        var alertmsg = '';
+        switch (current.value) {
+            case 'krb':
+                alertmsg = 'You need to specify the Kerberos domain';
+                break;
+            case 'loc':
+            case 'fsys':
+                alertmsg = 'You need to specify the initial password';
+                break;
+            case 'fsys':
+                alertmsg = '';
+                break;
+            default:
+                alertmsg = '';
+        }
+        if (alertmsg != '') {
+            alert(alertmsg);
+            return;
+        }
+    }
+    vf.submit();
+}
+                                                                                                                      
+$authheader
+ENDPICK
+                                                                                                                      
+}
+
+
 sub date_setting_table {
     my $starttime = time;
     my $endtime = time+(6*30*24*60*60); # 6 months from now, approx 
@@ -252,6 +324,7 @@
                   $ENV{'form.course_home'}.'</body></html>');
         return;
     }
+
 #
 # Open course
 #
@@ -278,40 +351,67 @@
     }
     if ($ENV{'form.crscode'}) {
         $envflag=1;
-        $cenv{'coursecode'}=$ENV{'form.crscode'};
+        $cenv{'internal.coursecode'}=$ENV{'form.crscode'};
     }
     if ($ENV{'form.crssections'}) {
         $envflag=1;
-        $cenv{'sectionnums'}=$ENV{'form.crssections'};
+        $cenv{'internal.sectionnums'}=$ENV{'form.crssections'};
     }
     if ($ENV{'form.crsxlist'}) {
         $envflag=1;
-        $cenv{'crosslistings'}=$ENV{'form.crsxlist'};
+        $cenv{'internal.crosslistings'}=$ENV{'form.crsxlist'};
     }
     if ($ENV{'form.autoadds'}) {
         $envflag=1;
-        $cenv{'autoadds'}=$ENV{'form.autoadds'};
+        $cenv{'internal.autoadds'}=$ENV{'form.autoadds'};
     }
     if ($ENV{'form.autodrops'}) {
         $envflag=1;
-        $cenv{'autodrops'}=$ENV{'form.autodrops'};
+        $cenv{'internal.autodrops'}=$ENV{'form.autodrops'};
     }
-    if ($ENV{'form.notifyemail'}) {
-        $envflag=1;
-        $cenv{'notification'}=$ENV{'form.notifyemail'};
-        if ($ccuname)
-        {
-# get e-mail address of ccuname.
-          $cenv{'notifylist'}= $ENV{'$ccuname'};
-        }
+    if ($ENV{'form.notify'}) {
+      $envflag=1;
+      if ($ccuname) {
+        $cenv{'internal.notifylist'} = $ccuname;
+      }
+    }
+    
+    if ($ccuname) {
+        $cenv{'internal.courseowner'} = $ccuname;
     }
+   
     my $startdate = &Apache::lonhtmlcommon::get_date_from_form('startdate');
     my $enddate   = &Apache::lonhtmlcommon::get_date_from_form('enddate');
     if ($ENV{'form.no_end_date'}) {
       $enddate = 0;
     }
-    $cenv{'autostart'}=$startdate;
-    $cenv{'autoend'}=$enddate;
+    $cenv{'internal.autostart'}=$startdate;
+    $cenv{'internal.autoend'}=$enddate;
+
+    if ($ENV{'form.showphotos'}) {
+      $cenv{'internal.showphotos'}=$ENV{'form.showphotos'};
+    }
+    if ($ENV{'form.login'} eq 'krb') {
+        $cenv{'internal.authtype'} = 'krb';
+        $cenv{'internal.authtype'} .=$ENV{'form.krbver'};
+        $cenv{'internal.autharg'} = $ENV{'form.krbarg'};
+    } elsif ($ENV{'form.login'} eq 'int') {
+        $cenv{'internal.authtype'} ='internal';
+        if ((defined($ENV{'form.intarg'})) && ($ENV{'form.intarg'})) {
+            $cenv{'internal.autharg'} = $ENV{'form.intarg'};
+        }
+    } elsif ($ENV{'form.login'} eq 'loc') {
+        $cenv{'internal.authtype'} = 'localauth';
+        if ((defined($ENV{'form.locarg'})) && ($ENV{'form.locarg'})) {
+            $cenv{'internal.autharg'} = $ENV{'form.locarg'};
+        }
+    }
+    if ( ($cenv{'internal.authtype'} =~ /^krb/) && ($cenv{'internal.autoadds'} == 1)) {
+        if (! defined($cenv{'internal.autharg'}) || $cenv{'internal.autharg'}  eq '') {
+            $r->print('<font color="red" size="+1">'.
+                      'As you did not include the default Kerberos domain to be used for authentication in this class, the institutional data used by the automated enrollment process must include the Kerberos domain for each new student'.'</font></p>');
+        }
+    }
 
     if (($ccdomain) && ($ccuname)) {
        if ($ENV{'form.setpolicy'}) {

--raeburn1070324656--