Diff for /loncom/interface/coursecatalog.pm between versions 1.7 and 1.12

version 1.7, 2006/10/16 19:39:51 version 1.12, 2006/12/11 15:13:26
Line 42  sub handler { Line 42  sub handler {
     if ($r->header_only) {      if ($r->header_only) {
         return OK;          return OK;
     }      }
       my %cookies=CGI::Cookie->parse($r->header_in('Cookie'));
       my $lonid=$cookies{'lonID'};
       my $lonidsdir=$r->dir_config('lonIDsDir');
       my $handle;
       if ($lonid) {
    $handle=&LONCAPA::clean_handle($lonid->value);
       }
       if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
           &Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
       }
     &Apache::lonacc::get_posted_cgi($r);      &Apache::lonacc::get_posted_cgi($r);
     &Apache::lonlocal::get_language_handle($r);      &Apache::lonlocal::get_language_handle($r);
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['sortby']);      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['sortby']);
Line 50  sub handler { Line 60  sub handler {
     my $domdesc = $Apache::lonnet::domaindescription{$codedom};      my $domdesc = $Apache::lonnet::domaindescription{$codedom};
   
     &Apache::lonhtmlcommon::clear_breadcrumbs();      &Apache::lonhtmlcommon::clear_breadcrumbs();
     if ($env{'form.coursenum'} ne '') {      if ($env{'form.coursenum'} ne '' && &user_is_known()) {
         &course_details($r,$codedom,$formname,$domdesc);          &course_details($r,$codedom,$formname,$domdesc);
     } else {      } else {
         &course_selector($r,$codedom,$formname,$domdesc);          &course_selector($r,$codedom,$formname,$domdesc);
Line 369  sub print_course_listing { Line 379  sub print_course_listing {
             $output = &mt('No courses match the criteria you selected.');              $output = &mt('No courses match the criteria you selected.');
             return $output;              return $output;
         }          }
         $output = &mt('<b>Note for students:</b> If you are officially enrolled in a course but the course is not listed in your LON-CAPA courses, click the "Show more details" link for the specific course and check the default access dates and/or automated enrollment settings.<br /><br />');          if (&user_is_known()) {
               $output = &mt('<b>Note for students:</b> If you are officially enrolled in a course but the course is not listed in your LON-CAPA courses, click the "Show more details" link for the specific course and check the default access dates and/or automated enrollment settings.<br /><br />');
           }
     }      }
     $output .= &Apache::loncommon::start_data_table().      $output .= &Apache::loncommon::start_data_table().
                &Apache::loncommon::start_data_table_header_row();                 &Apache::loncommon::start_data_table_header_row();
Line 389  sub print_course_listing { Line 401  sub print_course_listing {
         }          }
         $output .= '</th>';          $output .= '</th>';
     }      }
     if ($env{'form.coursenum'} eq '') {      if (&user_is_known()) {
         $output .= '<th>&nbsp;</th>';          if ($env{'form.coursenum'} eq '') {
     } else {              $output .= '<th>&nbsp;</th>';
         $output .=          } else {
               $output .=
               '<th>'.&mt('Default Access Dates for Students').'</th>'.                '<th>'.&mt('Default Access Dates for Students').'</th>'.
               '<th>'.&mt('Student Counts').'</th>'.                '<th>'.&mt('Student Counts').'</th>'.
               '<th>'.&mt('Auto-enrollment of <br />registered students').'</th>';                '<th>'.&mt('Auto-enrollment of <br />registered students').'</th>';
           }
     }      }
     &Apache::loncommon::end_data_table_header_row();      &Apache::loncommon::end_data_table_header_row();
     my %courseinfo = &build_courseinfo_hash(%courses);      my %courseinfo = &build_courseinfo_hash(%courses);
Line 441  sub build_courseinfo_hash { Line 455  sub build_courseinfo_hash {
         }          }
         my $cleandesc=&HTML::Entities::encode($descr,'<>&"');          my $cleandesc=&HTML::Entities::encode($descr,'<>&"');
         $cleandesc=~s/'/\\'/g;          $cleandesc=~s/'/\\'/g;
           $cleandesc =~ s/^\s+//;
         my ($cdom,$cnum)=split(/\_/,$course);          my ($cdom,$cnum)=split(/\_/,$course);
   
         my ($desc,$instcode,$owner,$ttype) = split(/:/,$courses{$course});          my ($desc,$instcode,$owner,$ttype) = split(/:/,$courses{$course});
Line 573  sub courseinfo_row { Line 588  sub courseinfo_row {
     }      }
     $output .= '</font></td>'.      $output .= '</font></td>'.
                '<td>'.$ownerlast.'</td>';                 '<td>'.$ownerlast.'</td>';
     if ($env{'form.coursenum'} eq '') {      if (&user_is_known()) {
         $output .= "<td><a href=\"javascript:setCourseId('$cnum')\">".&mt('Show more details').'</a></td>';          if ($env{'form.coursenum'} eq '') {
     } else {              $output .= "<td><a href=\"javascript:setCourseId('$cnum')\">".&mt('Show more details').'</a></td>';
         $output .=          } else { 
               $output .=
                '<td>'.$accessdates.'</td>'.                  '<td>'.$accessdates.'</td>'. 
                '<td>'.$counts.'</td>'.                 '<td>'.$counts.'</td>'.
                '<td>'.$autoenrollment.'</td>';                 '<td>'.$autoenrollment.'</td>';
           }
     }      }
     return $output;      return $output;
 }  }
Line 741  function courseSet() { Line 758  function courseSet() {
             }              }
         }          }
         else {          else {
             for (var k=0; k<idyears.length; k++) {              if (selDepartment > -1) {
                 if (idyears[k] == valyr) {                  for (var k=0; k<idyears.length; k++) {
                     idyr = k;                      if (idyears[k] == valyr) {
                           idyr = k;
                       }
                 }                  }
             }                  if (idyr != -1) {
             if (idyr != -1) {                      for (var k=0; k<idsems[idyr].length; k++) {
                 for (var k=0; k<idsems[idyr].length; k++) {                          if (idsems[idyr][k] == valsem) {
                     if (idsems[idyr][k] == valsem) {                              idsem = k;
                         idsem = k;                          }
                     }                      }
                 }                  }
             }                  if (idsem != -1) {
             if (idsem != -1) {                      for (var k=0; k<idcodes[idyr][idsem].length; k++) {
                 for (var k=0; k<idcodes[idyr][idsem].length; k++) {                          if (idcodes[idyr][idsem][k] == valdept) {
                     if (idcodes[idyr][idsem][k] == valdept) {                              iddept = k;
                         iddept = k;                          }
                     }                      }
                 }                  }
             }                  if (iddept != -1) {
             if (iddept != -1) {                      document.$formname.Number.options[0] =  new Option('All','0',false,false);
                 document.$formname.Number.options[0] =  new Option('All','0',false,false);                      for (var i=0; i<idcourses[idyr][idsem][iddept].length; i++) {
                 for (var i=0; i<idcourses[idyr][idsem][iddept].length; i++) {                          var display = idcourses[idyr][idsem][iddept][i];
                     var display = idcourses[idyr][idsem][iddept][i];                          if (longtitles[3] == 1) {
                     if (longtitles[3] == 1) {                              if (idcourseslongs[idyr][idsem][iddept][i] != "") {
                         if (idcourseslongs[idyr][idsem][iddept][i] != "") {                                  display = idcourseslongs[idyr][idsem][iddept][i]
                             display = idcourseslongs[idyr][idsem][iddept][i]                              }
                         }                          }
                           document.$formname.Number.options[i+1] = new Option(display,idcourses[idyr][idsem][iddept][i],false,false)
                     }                      }
                     document.$formname.Number.options[i+1] = new Option(display,idcourses[idyr][idsem][iddept][i],false,false)                  } 
                   else {
                       document.$formname.Number.options[0] =  new Option('No courses','0',true,true);
                 }                  }
             }              } 
             else {              else {
                 document.$formname.Number.options[0] =  new Option('No courses','0',true,true);                  document.$formname.Number.options[0] =  new Option('All','0',true,true);
             }              }
         }          }
         document.$formname.Number.selectedIndex = 0          document.$formname.Number.selectedIndex = 0
Line 821  sub autoenroll_info { Line 843  sub autoenroll_info {
     return $autoenrolldates;      return $autoenrolldates;
 }  }
   
   sub user_is_known {
       my $known = 0;
       if ($env{'user.name'} ne '' && $env{'user.name'} ne 'public' 
           && $env{'user.domain'} ne '' && $env{'user.domain'} ne 'public') {
           $known = 1;
       }
       return $known;
   }
   
 1;  1;

Removed from v.1.7  
changed lines
  Added in v.1.12


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