Diff for /loncom/interface/lonpickcourse.pm between versions 1.21 and 1.26

version 1.21, 2004/11/30 00:21:24 version 1.26, 2005/02/17 08:29:43
Line 42  sub handler { Line 42  sub handler {
     return OK if $r->header_only;      return OK if $r->header_only;
   
 # ------------------------------------------------------------ Print the screen  # ------------------------------------------------------------ Print the screen
       my $html=&Apache::lonxml::xmlbegin();
     $r->print(<<ENDDOCUMENT);      $r->print(<<ENDDOCUMENT);
 <html>  $html
 <head>  <head>
 <title>The LearningOnline Network with CAPA</title>  <title>The LearningOnline Network with CAPA</title>
 </head>  </head>
Line 153  function setSections() { Line 154  function setSections() {
     var sectionsArray = new Array("$seclist")      var sectionsArray = new Array("$seclist")
     opener.document.$ENV{"form.form"}.currsec.length = 0      opener.document.$ENV{"form.form"}.currsec.length = 0
     if (numSections == 0) {      if (numSections == 0) {
           opener.document.$ENV{"form.form"}.currsec.multiple=false
           opener.document.$ENV{"form.form"}.currsec.size=1;
         opener.document.$ENV{"form.form"}.currsec.options[0] = new Option('No existing sections','',false,false)          opener.document.$ENV{"form.form"}.currsec.options[0] = new Option('No existing sections','',false,false)
     }      }
     else {      else {
         for (var i=0; i<numSections; i++) {          if (numSections == 1) {
             opener.document.$ENV{"form.form"}.currsec.options[i] = new Option(sectionsArray[i],sectionsArray[i],false,false)              opener.document.$ENV{"form.form"}.currsec.multiple=false;
         }              opener.document.$ENV{"form.form"}.currsec.size=1;
         opener.document.$ENV{"form.form"}.currsec.multiple=true              opener.document.$ENV{"form.form"}.currsec.options[0] = new Option('Select','',true,true);
         if (numSections < 3) {              opener.document.$ENV{"form.form"}.currsec.options[1] = new Option('No section','',false,false) 
             opener.document.$ENV{"form.form"}.currsec.size=numSections;              opener.document.$ENV{"form.form"}.currsec.options[2] = new Option(sectionsArray[0],sectionsArray[0],false,false);
         }          }
         else {          else {
             opener.document.$ENV{"form.form"}.currsec.size=3;              for (var i=0; i<numSections; i++) {
                   opener.document.$ENV{"form.form"}.currsec.options[i] = new Option(sectionsArray[i],sectionsArray[i],false,false)
               }
               opener.document.$ENV{"form.form"}.currsec.multiple=true
               if (numSections < 3) {
                   opener.document.$ENV{"form.form"}.currsec.size=numSections;
               }
               else {
                   opener.document.$ENV{"form.form"}.currsec.size=3;
               }
               opener.document.$ENV{"form.form"}.currsec.options[0].selected = false
         }          }
         opener.document.$ENV{"form.form"}.currsec.options[0].selected = false  
     }      }
     self.close()      self.close()
 }  }
Line 214  ENDSCRIPT Line 226  ENDSCRIPT
             } else {              } else {
                 $descr = &Apache::lonnet::unescape($courses{$course});                  $descr = &Apache::lonnet::unescape($courses{$course});
             }              }
             $by_descrip{lc($descr)}=$course;              my $description = lc($descr);
               push (@{$by_descrip{$description}}, $course);
  }   }
  foreach my $description (sort(keys(%by_descrip))) {   foreach my $description (sort(keys(%by_descrip))) {
     my $course=$by_descrip{$description};              foreach my $course (@{$by_descrip{$description}}) {
     my $cleandesc=&HTML::Entities::encode($description,'<>&"');          my $cleandesc=&HTML::Entities::encode($description,'<>&"');
     $cleandesc=~s/'/\\'/g;          $cleandesc=~s/'/\\'/g;
     my ($cdom,$cnum)=split(/\_/,$course);          my ($cdom,$cnum)=split(/\_/,$course);
     $r->print('<input type="button" value="Select" onClick="gochoose('.                  my ($descr,$instcode,$owner) = split/:/,$courses{$course};
   "'".$cnum."','".$cdom."','".$cleandesc."')".'" /> '.$description.' ('.          $r->print('<input type="button" value="Select" onClick="gochoose('.
   ($Apache::lonnet::domaindescription{$cdom}?        "'".$cnum."','".$cdom."','".$cleandesc."')".'" /> '.$description.' ('.
                    $Apache::lonnet::domaindescription{$cdom}:$cdom).        ($Apache::lonnet::domaindescription{$cdom}?
                  ")<br />\n");                         $Apache::lonnet::domaindescription{$cdom}:$cdom).")");
                   unless ($instcode eq '') {
                       $r->print(" - ".&Apache::lonnet::unescape($instcode));
                   }
                   unless ($owner eq '') {
                       $r->print(", owner - ".&Apache::lonnet::unescape($owner));
                   }
                   $r->print("<br />\n");
               }
  }   }
  if (!%courses) { $r->print(&mt('None found')); }   if (!%courses) { $r->print(&mt('None found')); }
         $r->print('<input type="hidden" name="form" value="'.$ENV{'form.form'}.'" />'."\n".          $r->print('<input type="hidden" name="form" value="'.$ENV{'form.form'}.'" />'."\n".

Removed from v.1.21  
changed lines
  Added in v.1.26


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