--- loncom/interface/lonpickcourse.pm 2005/10/03 23:53:25 1.30
+++ loncom/interface/lonpickcourse.pm 2006/01/10 21:36:45 1.37
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.30 2005/10/03 23:53:25 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.37 2006/01/10 21:36:45 albertel 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;
@@ -82,7 +82,7 @@ ENDDOCUMENT
unless ($coursefilter) { $coursefilter=''; }
my $listcourseid=&HTML::Entities::encode($coursefilter,'<>&"');
$courseidtag = &mt('LON-CAPA course ID');
- $courseidtag .= qq|
+ $courseidtag .= qq|:
|;
}
@@ -111,20 +111,19 @@ 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);
}
}
-# if called from rolefilter, setup for multiple course selections.
- my $multflag = 0;
my $jscript;
my $title = 'Selecting a course';
- if ($env{'form.form'} eq 'rolefilter') {
- $multflag = 1;
+# Setup for multiple course selections, if flag for multiples set.
+ my $multiple = $env{'form.multiple'};
+ my $multelement;
+ if ($multiple) {
$title = 'Selecting course(s)';
- }
- if ($multflag) {
$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(
@@ -150,44 +149,59 @@ ENDDOCUMENT
my $roledom = $env{'form.roleelement'};
if ($roledom) {
$roleelement = '';
- $submitopener = &Apache::lonroles::processpick($roledom);
+ $submitopener = &Apache::lonroles::processpick();
$autosubmit = 'process_pick("'.$roledom.'")';
}
$r->print(<
-function gochoose(cname,cdom,cdesc,multflag,caller) {
+function gochoose(cname,cdom,cdesc,multiple,caller) {
var openerForm = "$env{'form.form'}";
courseCount = 0;
var courses = '';
- if (multflag) {
- for (var j=0; j 0) {
- courses = courses.substr(0,courses.length-2);
- opener.document.$env{'form.form'}.courselist.value = courses
- }
- }
- else {
+ if (typeof(opener.document.$env{'form.form'}.coursepick.length) ==
+ 'undefined') {
+ if (opener.document.$env{'form.form'}.coursepick.value == 'specific') {
+ opener.document.$env{'form.form'}.coursepick.checked = true;
+ } else {
+ opener.document.$env{'form.form'}.coursepick.checked = false;
+ }
+ } 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;
- if (openerForm == 'cu') {
+ var slct=opener.document.$env{'form.form'}.$env{'form.cdomelement'};
+ if (slct.options == undefined) {
opener.document.$env{'form.form'}.$env{'form.cdomelement'}.value=cdom;
}
else {
- var slct=opener.document.$env{'form.form'}.$env{'form.cdomelement'};
var i;
for (i=0;i
$roleelement
+$multelement
$lt{'cac'}: $sincefilterform
$lt{'cdo'}: $domainselectform
@@ -272,8 +284,8 @@ ENDSCRIPT
($domainfilter,$descriptfilter,$timefilter,$instcodefilter,$ownerfilter,$coursefilter);
$r->print('');
+ ''."\n");
+ if ((exists($env{'form.roleelement'})) && ($env{'form.form'} eq 'rolechoice')) {
+ $r->print(''."\n");
+ }
+ $r->print("\n");
}
$r->print('