--- loncom/interface/lonpickcourse.pm 2005/02/17 08:29:43 1.26
+++ loncom/interface/lonpickcourse.pm 2005/10/03 23:53:25 1.30
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.26 2005/02/17 08:29:43 albertel Exp $
+# $Id: lonpickcourse.pm,v 1.30 2005/10/03 23:53:25 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -54,27 +54,40 @@ ENDDOCUMENT
($ENV{'QUERY_STRING'},['domainfilter','descriptfilter',
'sincefilter','form','cnumelement',
'cdomelement','cnameelement','roleelement',
- 'pickedcourse','instcodefilter','ownerfilter']);
+ 'pickedcourse','instcodefilter',
+ 'ownerfilter','coursefilter']);
# domain filter and selection
- my $domainfilter=$ENV{'form.domainfilter'};
+ my $domainfilter=$env{'form.domainfilter'};
$domainfilter=~s/\W//g;
unless ($domainfilter) { $domainfilter=''; }
my $domainselectform=&Apache::loncommon::select_dom_form($domainfilter,
'domainfilter',1);
# description filter
- my $descriptfilter=$ENV{'form.descriptfilter'};
+ my $descriptfilter=$env{'form.descriptfilter'};
unless ($descriptfilter) { $descriptfilter=''; }
my $listdescript=&HTML::Entities::encode($descriptfilter,'<>&"');
# institutional code filter
- my $instcodefilter=$ENV{'form.instcodefilter'};
+ my $instcodefilter=$env{'form.instcodefilter'};
unless ($instcodefilter) { $instcodefilter=''; }
my $listinstcode=&HTML::Entities::encode($instcodefilter,'<>&"');
# course owner filter
- my $ownerfilter=$ENV{'form.ownerfilter'};
+ my $ownerfilter=$env{'form.ownerfilter'};
unless ($ownerfilter) { $ownerfilter=''; }
my $listowner=&HTML::Entities::encode($ownerfilter,'<>&"');
+# course ID filter for DCs only
+ my ($courseidtag,$coursefilter);
+ if ($env{'user.adv'} && $domainfilter && exists($env{'user.role.dc./'.
+ $domainfilter.'/'})) {
+ $coursefilter=$env{'form.coursefilter'};
+ unless ($coursefilter) { $coursefilter=''; }
+ my $listcourseid=&HTML::Entities::encode($coursefilter,'<>&"');
+ $courseidtag = &mt('LON-CAPA course ID');
+ $courseidtag .= qq|
+
+ |;
+ }
# last course activity filter and selection
- my $sincefilter=$ENV{'form.sincefilter'};
+ my $sincefilter=$env{'form.sincefilter'};
$sincefilter=~s/[^\d-]//g;
unless ($sincefilter) { $sincefilter=-1; }
my $sincefilterform=&Apache::loncommon::select_form($sincefilter,
@@ -91,9 +104,9 @@ ENDDOCUMENT
# if called from loncreateuser, report sections, then close
my ($loaditem,$seclist);
my $num_sections = 0;
- if ($ENV{'form.form'} eq 'cu' && $ENV{'form.pickedcourse'}) {
+ if ($env{'form.form'} eq 'cu' && $env{'form.pickedcourse'}) {
$loaditem = 'onLoad="setSections()"';
- my ($cdom,$cnum) = split/_/,$ENV{'form.pickedcourse'};
+ my ($cdom,$cnum) = split/_/,$env{'form.pickedcourse'};
my %sections_count = ();
$num_sections = &Apache::loncommon::get_sections($cdom,$cnum,\%sections_count);
my @sections = ();
@@ -102,7 +115,18 @@ ENDDOCUMENT
$seclist = join('","',@sections);
}
}
- $r->print(&Apache::loncommon::bodytag("Selecting a Course",undef,$loaditem));
+# 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;
+ $title = 'Selecting course(s)';
+ }
+ if ($multflag) {
+ $jscript = &Apache::loncommon::check_uncheck_jscript();
+ }
+ $r->print(&Apache::loncommon::bodytag($title,undef,$loaditem,undef,undef,undef,undef,1));
my %lt=&Apache::lonlocal::texthash(
'cac' => 'Course Activity',
'cde' => 'Course Description',
@@ -110,20 +134,20 @@ ENDDOCUMENT
'cin' => 'Course Institutional Code',
'cow' => "Course Owner's usename");
my ($name_code,$name_input);
- if (defined($ENV{'form.cnameelement'}) && $ENV{'form.cnameelement'} ne '') {
- $name_code = "opener.document.$ENV{'form.form'}.$ENV{'form.cnameelement'}.value=cdesc;";
+ if (defined($env{'form.cnameelement'}) && $env{'form.cnameelement'} ne '') {
+ $name_code = "opener.document.$env{'form.form'}.$env{'form.cnameelement'}.value=cdesc;";
$name_input ='';
+ $env{'form.cnameelement'}.'" />';
}
my $submitopener = '';
my $autosubmit = '';
my $roleelement = '';
my $lastaction = 'self.close()';
- if ($ENV{'form.form'} eq 'cu') {
+ if ($env{'form.form'} eq 'cu') {
$lastaction = 'document.courselist.pickedcourse.value = cdom+"_"+cname;'."\n".
'document.courselist.submit();';
}
- my $roledom = $ENV{'form.roleelement'};
+ my $roledom = $env{'form.roleelement'};
if ($roledom) {
$roleelement = '';
$submitopener = &Apache::lonroles::processpick($roledom);
@@ -131,18 +155,43 @@ ENDDOCUMENT
}
$r->print(<
-function gochoose(cname,cdom,cdesc) {
- $name_code
- 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;
+function gochoose(cname,cdom,cdesc,multflag,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 {
- var slct=opener.document.$ENV{'form.form'}.$ENV{'form.cdomelement'};
- var i;
- for (i=0;i
$submitopener
-');
}
$r->print('