Diff for /loncom/interface/lonpickcourse.pm between versions 1.83 and 1.84

version 1.83, 2009/07/25 23:16:04 version 1.84, 2009/07/29 22:32:44
Line 83  sub handler { Line 83  sub handler {
     }      }
   
     my %loaditem;      my %loaditem;
     if ($env{'form.numtitles'}) {      if (($env{'form.type'} eq 'Course') && ($env{'form.numtitles'})) {
         $loaditem{'onload'} = 'setElements(); ';          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')) &&       if ((($env{'form.form'} eq 'cu') || ($env{'form.form'} eq 'studentform')) && 
Line 112  sub handler { Line 114  sub handler {
     }      }
   
     # print javascript functions for choosing a course       # 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(&gochoose_javascript($type,$multiple,$autosubmit,$lastaction));
     }      }
     $r->print('<script type="text/javascript" language="Javascript">'.$jscript.      $r->print('<script type="text/javascript" language="Javascript">'.$jscript.
Line 149  sub handler { Line 151  sub handler {
     }      }
   
 # ---------------------------------------------------------------- Get the data  # ---------------------------------------------------------------- Get the data
     if ($env{'form.gosearch'} || $onlyown) {      if (($env{'form.command'} eq 'gosearch') || $onlyown) {
         my %courses = &search_courses($r,$type,$onlyown,$filter,$numtitles);          my %courses = &search_courses($r,$type,$onlyown,$filter,$numtitles);
         if ($nohost) {          if ($nohost) {
             $r->print ('<span class="LC_warning">'.              $r->print ('<span class="LC_warning">'.
Line 395  sub display_matched_courses { Line 397  sub display_matched_courses {
         $r->print('<input type="hidden" name="setroles" value="'.$env{'form.setroles'}.'" />');          $r->print('<input type="hidden" name="setroles" value="'.$env{'form.setroles'}.'" />');
         $r->print('<input type="hidden" name="action" value="rolepicker" />');          $r->print('<input type="hidden" name="action" value="rolepicker" />');
     } elsif ($env{'form.form'} eq 'modifycourse') {      } elsif ($env{'form.form'} eq 'modifycourse') {
         $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form','numtitles','state']));          $r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','pickedcourse','type','form','numtitles','state','command']));
     } else {      } else {
         $r->print('<input type="hidden" name="cnumelement" value="'.          $r->print('<input type="hidden" name="cnumelement" value="'.
                   $env{'form.cnumelement'}.'" />'."\n".                      $env{'form.cnumelement'}.'" />'."\n".  
Line 431  sub build_filters { Line 433  sub build_filters {
     } else {      } else {
         $formname = $caller;          $formname = $caller;
     }      }
       my $onchange;
       unless ($env{'form.interface'} eq 'textual') {
           $onchange = 1;
       }
     my ($domainselectform,$sincefilterform,$ownerdomselectform,$persondomselectform,      my ($domainselectform,$sincefilterform,$ownerdomselectform,$persondomselectform,
         $instcodeform,$typeselectform,$instcodetitle);          $instcodeform,$typeselectform,$instcodetitle);
     foreach my $item (@{$filterlist}) {      foreach my $item (@{$filterlist}) {
Line 450  sub build_filters { Line 456  sub build_filters {
             } elsif ($item eq 'personfilter') {              } elsif ($item eq 'personfilter') {
                 $filter->{$item} = &LONCAPA::clean_username($filter->{$item});                  $filter->{$item} = &LONCAPA::clean_username($filter->{$item});
                 if ($env{'form.persondomfilter'} eq '') {                  if ($env{'form.persondomfilter'} eq '') {
                     unless ($env{'form.gosearch'}) {                      unless ($env{'form.command'} eq 'gosearch') {
                         $filter->{'persondomfilter'} = $env{'request.role.domain'};                          $filter->{'persondomfilter'} = $env{'request.role.domain'};
                     }                      }
                 } else {                  } else {
Line 486  sub build_filters { Line 492  sub build_filters {
                 $domainselectform =                  $domainselectform =
     &Apache::loncommon::select_dom_form($filter->{$item},      &Apache::loncommon::select_dom_form($filter->{$item},
             'domainfilter',              'domainfilter',
         $allow_blank);          $allow_blank,'',$onchange);
                 $codedom = $filter->{'domainfilter'};                  $codedom = $filter->{'domainfilter'};
             }              }
         } else {          } else {
Line 518  sub build_filters { Line 524  sub build_filters {
               'inc' => &mt('Institutional Categorization'),                'inc' => &mt('Institutional Categorization'),
               'cow' => &mt("$type Owner/Co-owner"),                'cow' => &mt("$type Owner/Co-owner"),
               'cop' => &mt("$type Personnel Includes"),                'cop' => &mt("$type Personnel Includes"),
               'cog' => &mt('Course Type')                'cog' => &mt('Type')
              );               );
   
     $typeselectform =  '<select name="type" size="1">'."\n";      $typeselectform =  '<select name="type" size="1"';
       if ($onchange) {
           $typeselectform .= 'onchange=" javascript:submit()"';
       }
       $typeselectform .= '>'."\n";
     my $officialjs;      my $officialjs;
     if ($type eq 'Course') {      if ($type eq 'Course') {
         if ($env{'form.fixeddom'}) {          if (($env{'form.fixeddom'}) || ($env{'form.form'} eq 'requestcrs')) {
             $officialjs = 1;              $officialjs = 1;
             ($instcodeform,$jscript,$$numtitlesref) =               ($instcodeform,$jscript,$$numtitlesref) = 
                 &instcode_selectors($codedom,'filterpicker',$officialjs);                  &instcode_selectors($codedom,'filterpicker',$officialjs);
Line 540  sub build_filters { Line 550  sub build_filters {
         if ($env{'form.fixeddom'}) {          if ($env{'form.fixeddom'}) {
             $instcodetitle .= '<br />('.$codedom.')';              $instcodetitle .= '<br />('.$codedom.')';
         }          }
         if ($jscript ne '') {  
             $jscript = '<script type="text/javascript" language="Javascript">'.$jscript.  
                        '</script>'."\n";  
         }  
     }      }
       $jscript .= <<"END_JS";
   
   function setCommand() {
       document.filterpicker.command.value = 'gosearch';
       return;
   }
   
   END_JS
   
       $jscript = '<script type="text/javascript" language="Javascript">'.$jscript.
                  '</script>'."\n";
   
     foreach my $posstype ('Course','Community') {      foreach my $posstype ('Course','Community') {
         $typeselectform.='<option value="'.$posstype.'"'.          $typeselectform.='<option value="'.$posstype.'"'.
             ($posstype eq $type ? ' selected="selected" ' : ''). ">".&mt($posstype)."</option>\n";              ($posstype eq $type ? ' selected="selected" ' : ''). ">".&mt($posstype)."</option>\n";
     }      }
     $typeselectform.="</select>";      $typeselectform.="</select>";
     my $output = qq|      my $output = qq|
 <form method="post" name="filterpicker" action="$action">  <form method="post" name="filterpicker" action="$action" onsubmit="setCommand()">
 <input type="hidden" name="form" value="$formname" />  <input type="hidden" name="form" value="$formname" />
 |;  |;
     if ($formname eq 'modifycourse') {      if ($formname eq 'modifycourse') {
Line 628  $multelement Line 646  $multelement
                   .&Apache::lonhtmlcommon::row_closure(1);                    .&Apache::lonhtmlcommon::row_closure(1);
     }      }
     $output .= &Apache::lonhtmlcommon::end_pick_box();      $output .= &Apache::lonhtmlcommon::end_pick_box();
     $output .= '<p><input type="submit" name="gosearch" value="'.       $output .= '<p><input type="hidden" name="command" value="">'."\n".
                  '<input type="submit" name="gosearch" value="'. 
                &mt('Search').'" /></p>'."\n".'</form>'."\n".'<hr />'."\n";                 &mt('Search').'" /></p>'."\n".'</form>'."\n".'<hr />'."\n";
     return $jscript.$output;      return $jscript.$output;
 }  }
Line 640  sub instcode_selectors { Line 659  sub instcode_selectors {
         &Apache::courseclassifier::instcode_selectors_data($codedom,$formname,          &Apache::courseclassifier::instcode_selectors_data($codedom,$formname,
                            \%cat_items,\@codetitles,\%cat_titles,\%cat_order,$officialjs);                             \%cat_items,\@codetitles,\%cat_titles,\%cat_order,$officialjs);
     if ($numtitles > 0) {      if ($numtitles > 0) {
         my $unofficial = ' checked="checked" ';          my $official = ' checked="checked" ';
         my $official = '';          my $unofficial = '';
         if ($env{'form.official'}) {          if ($env{'form.official'} eq 'off') {
             $official = $unofficial;              $unofficial = $official;
             $unofficial = '';              $official = '';
         }          }
         $output .= '<span class="LC_nobreak">'.&mt('Official course:').'&nbsp;<label>'.          $output .= '<span class="LC_nobreak">'.&mt('Official course:').'&nbsp;<label>'.
                    '<input type="radio" name="official" value="1"'.$official.' />'.                     '<input type="radio" name="official" value="on"'.$official.' />'.
                    &mt('Yes').'</label>'.('&nbsp;'x3).'<label>'.                     &mt('Yes').'</label>'.('&nbsp;'x3).'<label>'.
                    '<input type="radio" name="official" value="0"'.$unofficial.                     '<input type="radio" name="official" value="off"'.$unofficial.
                    ' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'.                     ' onclick="toggleOfficial();" />'.&mt('No').'</label></span><br />'.
                    &Apache::courseclassifier::build_instcode_selectors($numtitles,                     &Apache::courseclassifier::build_instcode_selectors($numtitles,
                    $lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order)."\n".                     $lasttitle,\%cat_items,\@codetitles,\%cat_titles,\%cat_order)."\n".
Line 680  sub search_courses { Line 699  sub search_courses {
            ($filter->{'sincefilter'}==-1?1:time-$filter->{'sincefilter'});             ($filter->{'sincefilter'}==-1?1:time-$filter->{'sincefilter'});
         my ($instcodefilter,$regexpok);          my ($instcodefilter,$regexpok);
         if ($numtitles) {          if ($numtitles) {
             if ($env{'form.official'}) {              if ($env{'form.official'} eq 'on') {
                 $instcodefilter =                   $instcodefilter = 
                     &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},                      &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles);
                                                                    $numtitles);  
                 $regexpok = 1;                  $regexpok = 1;
               } elsif ($env{'form.official'} eq 'off') {
                   $instcodefilter = &Apache::courseclassifier::instcode_search_str($filter->{'domainfilter'},$numtitles);
                   unless ($instcodefilter eq '') {
                       $regexpok = -1;
                   }
             }              }
         } else {          } else {
             $instcodefilter = $filter->{'instcodefilter'};              $instcodefilter = $filter->{'instcodefilter'};
Line 870  Course Activity - how recently was cours Line 893  Course Activity - how recently was cours
 Course Domain - the domain of the course  Course Domain - the domain of the course
   
 =item *  =item *
 Course Type - Course or Community  Type - Course or Community
   
 =item *  =item *
 Course Institutional Code - the institutional identifier assigned to the course  Course Institutional Code - the institutional identifier assigned to the course
Line 1031  javascript functions used when user sele Line 1054  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.  (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  =back
             
 =cut  =cut

Removed from v.1.83  
changed lines
  Added in v.1.84


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>