--- loncom/interface/lonpickcourse.pm 2009/05/05 05:30:00 1.80
+++ loncom/interface/lonpickcourse.pm 2009/07/29 22:32:44 1.84
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Pick a course
#
-# $Id: lonpickcourse.pm,v 1.80 2009/05/05 05:30:00 raeburn Exp $
+# $Id: lonpickcourse.pm,v 1.84 2009/07/29 22:32:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -51,22 +51,21 @@ sub handler {
($ENV{'QUERY_STRING'},['domainfilter','form','cnumelement',
'cdomelement','cnameelement','roleelement',
'multiple','type','setroles','fixeddom']);
-
my ($type,$title,$jscript,$multelement,$multiple,$roleelement,
$lastaction,$autosubmit,$submitopener);
- # Get course type - Course or Non-standard Course.
+ # Get course type - Course or Community.
$type = $env{'form.type'};
if (!defined($env{'form.type'})) {
$type = 'Course';
}
- $title = &mt('Selecting a [_1]',$type);
+ $title = 'Selecting a '.$type;
# Setup for multiple course selections, if flag for multiples set.
$multiple = $env{'form.multiple'};
if ($multiple) {
($jscript,$multelement) = &multiples_tag();
- $title = &mt('Selecting [_1](s)',lc($type));
+ $title = 'Selecting '.$type.'(s)';
}
# if called when a DC is selecting a course
@@ -84,8 +83,10 @@ sub handler {
}
my %loaditem;
- if ($env{'form.numtitles'}) {
- $loaditem{'onload'} = 'setElements(); ';
+ if (($env{'form.type'} eq 'Course') && ($env{'form.numtitles'})) {
+ if (($env{'form.official'} eq 'on') && ($env{'form.state'} eq 'listing')) {
+ $loaditem{'onload'} = 'setElements(document.filterpicker); ';
+ }
}
if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) &&
@@ -113,7 +114,7 @@ sub handler {
}
# print javascript functions for choosing a course
- if ($env{'form.gosearch'} || $onlyown) {
+ if (($env{'form.command'} eq 'gosearch') || $onlyown) {
$r->print(&gochoose_javascript($type,$multiple,$autosubmit,$lastaction));
}
$r->print(''."\n";
- }
}
- foreach my $posstype ('Course','Non-standard Course') {
+ $jscript .= <<"END_JS";
+
+function setCommand() {
+ document.filterpicker.command.value = 'gosearch';
+ return;
+}
+
+END_JS
+
+ $jscript = ''."\n";
+
+ foreach my $posstype ('Course','Community') {
$typeselectform.='\n";
}
$typeselectform.="";
my $output = qq|
-
'."\n".''."\n";
return $jscript.$output;
}
@@ -639,16 +659,16 @@ sub instcode_selectors {
&Apache::courseclassifier::instcode_selectors_data($codedom,$formname,
\%cat_items,\@codetitles,\%cat_titles,\%cat_order,$officialjs);
if ($numtitles > 0) {
- my $unofficial = ' checked="checked" ';
- my $official = '';
- if ($env{'form.official'}) {
- $official = $unofficial;
- $unofficial = '';
+ my $official = ' checked="checked" ';
+ my $unofficial = '';
+ if ($env{'form.official'} eq 'off') {
+ $unofficial = $official;
+ $official = '';
}
$output .= ''.&mt('Official course:').' '.(' 'x3).' '.
&Apache::courseclassifier::build_instcode_selectors($numtitles,
$lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order)."\n".
@@ -679,11 +699,15 @@ sub search_courses {
($filter->{'sincefilter'}==-1?1:time-$filter->{'sincefilter'});
my ($instcodefilter,$regexpok);
if ($numtitles) {
- if ($env{'form.official'}) {
+ if ($env{'form.official'} eq 'on') {
$instcodefilter =
- &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},
- $numtitles);
+ &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles);
$regexpok = 1;
+ } elsif ($env{'form.official'} eq 'off') {
+ $instcodefilter = &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles);
+ unless ($instcodefilter eq '') {
+ $regexpok = -1;
+ }
}
} else {
$instcodefilter = $filter->{'instcodefilter'};
@@ -752,7 +776,7 @@ sub gochoose_javascript {
total => 'coursetotal',
list => 'courselist',
},
- 'Non-standard Course' => {
+ 'Community' => {
name => 'grouppick',
total => 'grouptotal',
list => 'grouplist',
@@ -869,7 +893,7 @@ Course Activity - how recently was cours
Course Domain - the domain of the course
=item *
-Course Type - Course or Non-standard Course
+Type - Course or Community
=item *
Course Institutional Code - the institutional identifier assigned to the course
@@ -922,7 +946,7 @@ Following selection, and/or submission,
X
B:
-Input: 1 - $type - the course type - Course or Non-standard Course
+Input: 1 - $type - the course type - Course or Community
Output: 1 - $output - javascript wrapped in EscriptEE/scriptE tags
@@ -954,10 +978,10 @@ Side Effects: None
=item *
X
-B:
+B:
-Input: 7 - anonymous array of search criteria; course type; $roleelement ; $multelement ; anonymous hash of criteria and their values; form action; ref to scalar (count of number of elements in institutional codes -- e.g., 4 for year, semester, department, and number).
+Input: 7 - anonymous array of search criteria; course type; $roleelement ; $multelement ; anonymous hash of criteria and their values; form action; ref to scalar (count of number of elements in institutional codes -- e.g., 4 for year, semester, department, and number); caller context (e.g., set to 'modifycourse' when routine is called from lonmodifycourse.pm).
Output: 1 - $output - HTML for display of search criteria, and hidden form elements.
@@ -1030,6 +1054,10 @@ javascript functions used when user sele
(g) Scantron Operator uploading a scantron file to a course - course number is written to visible form element in opener window. Child window closes.
+=item
+
+(h) User requesting creation of a course, and selecting a course to clone - course number and domain written to visible form elements in opener window. Child window closes.
+
=back
=cut