--- loncom/interface/lonpickcourse.pm 2005/04/12 00:20:01 1.28
+++ loncom/interface/lonpickcourse.pm 2005/11/15 20:46:40 1.35
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.28 2005/04/12 00:20:01 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.35 2005/11/15 20:46:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -55,7 +55,7 @@ ENDDOCUMENT
'sincefilter','form','cnumelement',
'cdomelement','cnameelement','roleelement',
'pickedcourse','instcodefilter',
- 'ownerfilter','coursefilter']);
+ 'ownerfilter','coursefilter','multiple']);
# domain filter and selection
my $domainfilter=$env{'form.domainfilter'};
$domainfilter=~s/\W//g;
@@ -111,11 +111,21 @@ ENDDOCUMENT
$num_sections = &Apache::loncommon::get_sections($cdom,$cnum,\%sections_count);
my @sections = ();
if ($num_sections > 0) {
- @sections = (sort {$a <=> $b} keys %sections_count);
+ @sections = (sort {$a <=> $b} keys(%sections_count));
$seclist = join('","',@sections);
}
}
- $r->print(&Apache::loncommon::bodytag("Selecting a Course",undef,$loaditem));
+ my $jscript;
+ my $title = 'Selecting a course';
+# Setup for multiple course selections, if flag for multiples set.
+ my $multiple = $env{'form.multiple'};
+ my $multelement;
+ if ($multiple) {
+ $title = 'Selecting course(s)';
+ $jscript = &Apache::loncommon::check_uncheck_jscript();
+ $multelement = '';
+ }
+ $r->print(&Apache::loncommon::bodytag($title,undef,$loaditem,undef,undef,undef,undef,1));
my %lt=&Apache::lonlocal::texthash(
'cac' => 'Course Activity',
'cde' => 'Course Description',
@@ -144,18 +154,58 @@ ENDDOCUMENT
}
$r->print(<
-function gochoose(cname,cdom,cdesc) {
- $name_code
+function gochoose(cname,cdom,cdesc,multiple,caller) {
var openerForm = "$env{'form.form'}";
- opener.document.$env{'form.form'}.$env{'form.cnumelement'}.value=cname;
- if (openerForm == 'cu' || openerForm == 'rolechoice') {
- opener.document.$env{'form.form'}.$env{'form.cdomelement'}.value=cdom;
- }
- else {
+ courseCount = 0;
+ var courses = '';
+ if (multiple) {
+ if (typeof(document.courselist.course_id.length) == 'undefined') {
+ // only 1 course checkbox was created
+ if (document.courselist.course_id.checked) {
+ courses = courses + document.courselist.course_id.value + "&&";
+ courseCount ++;
+ }
+ } else {
+ for (var j=0; j 0) {
+ courses = courses.substr(0,courses.length-2);
+ opener.document.$env{'form.form'}.courselist.value = courses;
+ }
+ } else {
+ $name_code
+ opener.document.$env{'form.form'}.$env{'form.cnumelement'}.value=cname;
var slct=opener.document.$env{'form.form'}.$env{'form.cdomelement'};
- var i;
- for (i=0;i
$submitopener
-