--- loncom/interface/Attic/londropadd.pm 2000/12/26 16:39:28 1.1
+++ loncom/interface/Attic/londropadd.pm 2002/09/18 14:17:47 1.51
@@ -1,73 +1,1473 @@
# The LearningOnline Network with CAPA
# Handler to drop and add students in courses
#
-# (Handler to set parameters for assessments
+# $Id: londropadd.pm,v 1.51 2002/09/18 14:17:47 matthew Exp $
#
-# (Handler to resolve ambiguous file locations
+# Copyright Michigan State University Board of Trustees
#
-# (TeX Content Handler
+# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
+#
+# LON-CAPA is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# LON-CAPA is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with LON-CAPA; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+# /home/httpd/html/adm/gpl.txt
+#
+# http://www.lon-capa.org/
#
-# 05/29/00,05/30,10/11 Gerd Kortemeyer)
+# (Handler to set parameters for assessments
#
-# 10/11,10/12,10/16 Gerd Kortemeyer)
+# (Handler to resolve ambiguous file locations
#
-# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28,
-# 12/08,12/12 Gerd Kortemeyer)
+# (TeX Content Handler
#
-# 12/26 Gerd Kortemeyer
+###############################################################
+###############################################################
package Apache::londropadd;
use strict;
-use Apache::lonnet;
+use Apache::lonnet();
+use Apache::loncommon();
+use Apache::lonhtmlcommon();
use Apache::Constants qw(:common :http REDIRECT);
+###############################################################
+###############################################################
+sub header {
+ my $bodytag=&Apache::loncommon::bodytag('Enrollment Manager');
+ return(<
+
+LON-CAPA Enrollment Manager
+
+$bodytag
+
+END
+}
+
+###############################################################
+###############################################################
+sub print_upload_manager_header {
+ my ($r,$datatoken,$distotal,$krbdefdom)=@_;
+ my $javascript;
+ if (! exists($ENV{'form.upfile_associate'})) {
+ $ENV{'form.upfile_associate'} = 'forward';
+ }
+ if ($ENV{'form.associate'} eq 'Reverse Association') {
+ if ( $ENV{'form.upfile_associate'} ne 'reverse' ) {
+ $ENV{'form.upfile_associate'} = 'reverse';
+ } else {
+ $ENV{'form.upfile_associate'} = 'forward';
+ }
+ }
+ if ($ENV{'form.upfile_associate'} eq 'reverse') {
+ $javascript=&upload_manager_javascript_reverse_associate();
+ } else {
+ $javascript=&upload_manager_javascript_forward_associate();
+ }
+ my $javascript_validations=&javascript_validations($krbdefdom);
+ $r->print(<Uploading Class List
+
+
Identify fields
+Total number of records found in file: $distotal
+Enter as many fields as you can. The system will inform you and bring you back
+to this page if the data selected is insufficient to run your class.
+
+
+
+
+
+
+
+
+
+
+ENDPICK
+}
+
+###############################################################
+###############################################################
+sub javascript_validations {
+ my ($krbdefdom)=@_;
+ my %param = ( formname => 'studentform',
+ kerb_def_dom => $krbdefdom );
+ my $authheader = &Apache::loncommon::authform_header(%param);
+ return (<header_only) {
- $r->content_type('text/html');
- $r->send_http_header;
- return OK;
+}
+
+###############################################################
+###############################################################
+sub upload_manager_javascript_forward_associate {
+ return(<=2) && (tw<=6)) { foundname=1; }
+ if (tw==7) { foundid=1; }
+ if (tw==8) { foundsec=1; }
+ if (tw==9) { foundpwd=1; }
+ }
+ verify_message(vf,founduname,foundpwd,foundname,foundid,foundsec);
+}
+
+//
+// vf = this.form
+// tf = column number
+//
+// values of nw
+//
+// 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)
+//
+function flip(vf,tf) {
+ var nw=eval('vf.f'+tf+'.selectedIndex');
+ var i;
+ // make sure no other columns are labeled the same as this one
+ for (i=0;i<=vf.nfields.value;i++) {
+ if ((i!=tf) && (eval('vf.f'+i+'.selectedIndex')==nw)) {
+ eval('vf.f'+i+'.selectedIndex=0;')
+ }
}
+ // 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) {
+ for (i=0;i<=vf.nfields.value;i++) {
+ if ((eval('vf.f'+i+'.selectedIndex')>=3) &&
+ (eval('vf.f'+i+'.selectedIndex')<=6)) {
+ 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)) {
+ for (i=0;i<=vf.nfields.value;i++) {
+ if (eval('vf.f'+i+'.selectedIndex')==2) {
+ eval('vf.f'+i+'.selectedIndex=0;')
+ }
+ }
+ }
+ // If we set the password, make the password form below correspond to
+ // the new value.
+ if (nw==9) {
+ changed_radio('int',document.studentform);
+ set_auth_radio_buttons('int',document.studentform);
+ vf.intarg.value='';
+ vf.krbarg.value='';
+ vf.locarg.value='';
+ }
+}
-# ----------------------------------------------------- Needs to be in a course
+function clearpwd(vf) {
+ var i;
+ for (i=0;i<=vf.nfields.value;i++) {
+ if (eval('vf.f'+i+'.selectedIndex')==9) {
+ eval('vf.f'+i+'.selectedIndex=0;')
+ }
+ }
+}
- if (($ENV{'request.course.fn'}) &&
- (&Apache::lonnet::allowed('cst',$ENV{'request.course.id'}))) {
+ENDPICK
+}
-# ------------------------------------------------------------------ Start page
- $r->content_type('text/html');
- $r->send_http_header;
- $r->print(<
-
-LON-CAPA Student Drop/Add
-
-
-
-