--- loncom/interface/lonpickcourse.pm 2009/07/25 23:16:04 1.83 +++ 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.83 2009/07/25 23:16:04 raeburn Exp $ +# $Id: lonpickcourse.pm,v 1.84 2009/07/29 22:32:44 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -83,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')) && @@ -112,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"; - } } + $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| -
+ |; if ($formname eq 'modifycourse') { @@ -628,7 +646,8 @@ $multelement .&Apache::lonhtmlcommon::row_closure(1); } $output .= &Apache::lonhtmlcommon::end_pick_box(); - $output .= '

'."\n". + '

'."\n".'
'."\n".'
'."\n"; return $jscript.$output; } @@ -640,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". @@ -680,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'}; @@ -870,7 +893,7 @@ Course Activity - how recently was cours Course Domain - the domain of the course =item * -Course Type - Course or Community +Type - Course or Community =item * Course Institutional Code - the institutional identifier assigned to the course @@ -1031,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