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

raeburn lon-capa-cvs@mail.lon-capa.org
Fri, 05 Dec 2003 21:34:48 -0000


raeburn		Fri Dec  5 16:34:48 2003 EDT

  Modified files:              
    /loncom/interface	loncreatecourse.pm 
  Log:
  Replaced local versions of javascript_validations and date_setting_table with calls to londropadd.pm to retrieve these functions, customized based on passed parameter - $mode = 'createcourse'.  This now supports entry of default authentication method and start and end dates for automated enrollment process. 
  
  
Index: loncom/interface/loncreatecourse.pm
diff -u loncom/interface/loncreatecourse.pm:1.40 loncom/interface/loncreatecourse.pm:1.41
--- loncom/interface/loncreatecourse.pm:1.40	Fri Dec  5 10:57:37 2003
+++ loncom/interface/loncreatecourse.pm	Fri Dec  5 16:34:48 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Create a course
 #
-# $Id: loncreatecourse.pm,v 1.40 2003/12/05 15:57:37 raeburn Exp $
+# $Id: loncreatecourse.pm,v 1.41 2003/12/05 21:34:48 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -48,6 +48,7 @@
 use Apache::lonratedt;
 use Apache::londocs;
 use Apache::lonlocal;
+use Apache::londropadd;
 
 # ================================================ Get course directory listing
 
@@ -243,10 +244,11 @@
 		     &Apache::loncommon::selectcourse_link
 		     ('ccrs','clonecourse','clonedomain');
     my $coursebrowserjs=&Apache::loncommon::coursebrowser_javascript();
-    my $date_table = &date_setting_table();
+    print STDERR "Course browser js is $coursebrowserjs\n";
+    my $date_table = &Apache::londropadd::date_setting_table('','','createcourse');
     my ($krbdef,$krbdefdom) =
     &Apache::loncommon::get_kerberos_defaults($defdom);
-    my $javascript_validations=&javascript_validations($krbdefdom);
+    my $javascript_validations=&Apache::londropadd::javascript_validations('createcourse',$krbdefdom);
     my %param = ( formname => 'document.ccrs',
                    kerb_def_dom => $krbdefdom,
                    kerb_def_auth => $krbdef
@@ -274,6 +276,7 @@
     editbrowser = open(url,title,options,'1');
     editbrowser.focus();
 }
+$javascript_validations
 </script>
 $coursebrowserjs
 <head>
@@ -403,74 +406,12 @@
 <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="button" onClick="verify_message(this.form)" value="Open Course">
 </p>
 </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
-    my $startform = &Apache::lonhtmlcommon::date_setter('ccrs','startdate',$starttime);
-    my $endform =  &Apache::lonhtmlcommon::date_setter('ccrs','enddate',$endtime);
-    my $perpetual = '<nobr><input type="checkbox" name="no_end_date"/> no ending date</nobr>';
-    my $result = '';
-    $result .= "<table>\n";
-    $result .= '<tr><td align="right">Starting Date</td>'.
-        '<td>'.$startform.'</td>'.
-        '<td></td>'."</tr>\n";
-    $result .= '<tr><td align="right">Ending Date</td>'.
-        '<td>'.$endform.'</td>'.
-        '<td>'.$perpetual.'</td>'."</tr>\n";
-    $result .= "</table>\n";
-    return $result;
 }
 
 # ====================================================== Phase two: make course