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

raeburn lon-capa-cvs@mail.lon-capa.org
Sun, 28 Dec 2003 01:30:50 -0000


raeburn		Sat Dec 27 20:30:50 2003 EDT

  Modified files:              
    /loncom/interface	londropadd.pm 
  Log:
  Modifications to &javascript_validations() to simplify code for use by loncreatecourse and lonmodifycourse.
  
  
Index: loncom/interface/londropadd.pm
diff -u loncom/interface/londropadd.pm:1.96 loncom/interface/londropadd.pm:1.97
--- loncom/interface/londropadd.pm:1.96	Sat Dec 27 18:38:13 2003
+++ loncom/interface/londropadd.pm	Sat Dec 27 20:30:50 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to drop and add students in courses 
 #
-# $Id: londropadd.pm,v 1.96 2003/12/27 23:38:13 raeburn Exp $
+# $Id: londropadd.pm,v 1.97 2003/12/28 01:30:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -263,12 +263,10 @@
     my $function_name =(<<END);
 function verify_message (vf,founduname,foundpwd,foundname,foundid,foundsec,foundemail) {
 END
-    my $auth_checks = (<<END);
-    var foundatype=0;
-END
+    my $auth_checks;
     if ($mode eq 'createcourse') {
         $auth_checks .= (<<END);
-    if (document.ccrs.autoadds[0].checked == true) {
+    if (vf.autoadds[0].checked == true) {
         if (current.radiovalue == null || current.radiovalue == 'nochange') {
             alert('$alert{'authen'}');
             return;
@@ -277,6 +275,7 @@
 END
     } else {
         $auth_checks .= (<<END);
+    var foundatype=0;
     if (founduname==0) {
 	alert('$alert{'username'}');
         return;
@@ -289,30 +288,29 @@
     }
 END
     }
-    if ( ($mode eq 'createcourse') || ($mode eq 'modifycourse') ) {
+    if ($mode eq 'createcourse') {
         $auth_checks .= "
-    foundatype=1";
-        if ($mode eq 'createcourse') {
-            $auth_checks .= "
-    if ( (document.ccrs.autoadds[0].checked == true) &&
-         (document.ccrs.elements[current.argfield].value == null || document.ccrs.elements[current.argfield].value == '') ) {";
-        } elsif ($mode eq 'modifycourse') {
-            $auth_checks .= " 
-    if (document.ccrs.elements[current.argfield].value == null || document.cmod.elements[current.argfield].value == '') }";
-        }
+    if ( (vf.autoadds[0].checked == true) &&
+         (vf.elements[current.argfield].value == null || vf.elements[current.argfield].value == '') ) {
+";
+    } elsif ($mode eq 'modifycourse') {
+        $auth_checks .= " 
+    if (vf.elements[current.argfield].value == null || vf.elements[current.argfield].value == '') {
+";
+    }
+    if ( ($mode eq 'createcourse') || ($mode eq 'modifycourse') ) {
         $auth_checks .= (<<END);
-            var alertmsg = '';
-            switch (current.radiovalue) {
-                case 'krb':
-                    alertmsg = '$alert{'krb'}';
-                    break;
-                default:
-                    alertmsg = '';
-            }
-            if (alertmsg != '') {
-                alert(alertmsg);
-                return;
-            }
+        var alertmsg = '';
+        switch (current.radiovalue) {
+            case 'krb':
+                alertmsg = '$alert{'krb'}';
+                break;
+            default:
+                alertmsg = '';
+        }
+        if (alertmsg != '') {
+            alert(alertmsg);
+            return;
         }
     }
 END