Diff for /loncom/interface/loncommon.pm between versions 1.692.4.23 and 1.692.4.24

version 1.692.4.23, 2010/01/19 16:20:38 version 1.692.4.24, 2010/01/19 16:27:47
Line 8994  sub extract_categories { Line 8994  sub extract_categories {
                 my $trailstr;                  my $trailstr;
                 if ($name eq 'instcode') {                  if ($name eq 'instcode') {
                     $trailstr = &mt('Official courses (with institutional codes)');                      $trailstr = &mt('Official courses (with institutional codes)');
                   } elsif ($name eq 'communities') {
                       $trailstr = &mt('Communities');
                 } else {                  } else {
                     $trailstr = $name;                      $trailstr = $name;
                 }                  }
Line 9104  Inputs: Line 9106  Inputs:
 cathash - reference to hash of categories defined for the domain (from  cathash - reference to hash of categories defined for the domain (from
           configuration.db)            configuration.db)
   
 currcat - scalar with an & separated list of categories assigned to a course.   currcat - scalar with an & separated list of categories assigned to a course.
   
   type    - scalar contains course type (Course or Community).
   
 Returns: $output (markup to be displayed)   Returns: $output (markup to be displayed) 
   
 =cut  =cut
   
 sub assign_categories_table {  sub assign_categories_table {
     my ($cathash,$currcat) = @_;      my ($cathash,$currcat,$type) = @_;
     my $output;      my $output;
     if (ref($cathash) eq 'HASH') {      if (ref($cathash) eq 'HASH') {
         my (@cats,@trails,%allitems,%idx,@jsarray,@path,$maxdepth);          my (@cats,@trails,%allitems,%idx,@jsarray,@path,$maxdepth);
Line 9120  sub assign_categories_table { Line 9124  sub assign_categories_table {
         if (@cats > 0) {          if (@cats > 0) {
             my $itemcount = 0;              my $itemcount = 0;
             if (ref($cats[0]) eq 'ARRAY') {              if (ref($cats[0]) eq 'ARRAY') {
                 $output = &Apache::loncommon::start_data_table();  
                 my @currcategories;                  my @currcategories;
                 if ($currcat ne '') {                  if ($currcat ne '') {
                     @currcategories = split('&',$currcat);                      @currcategories = split('&',$currcat);
                 }                  }
                   my $table;
                 for (my $i=0; $i<@{$cats[0]}; $i++) {                  for (my $i=0; $i<@{$cats[0]}; $i++) {
                     my $parent = $cats[0][$i];                      my $parent = $cats[0][$i];
                     my $css_class = $itemcount%2?' class="LC_odd_row"':'';  
                     next if ($parent eq 'instcode');                      next if ($parent eq 'instcode');
                       if ($type eq 'Community') {
                           next unless ($parent eq 'communities');
                       } else {
                           next if ($parent eq 'communities');
                       }
                       my $css_class = $itemcount%2?' class="LC_odd_row"':'';
                     my $item = &escape($parent).'::0';                      my $item = &escape($parent).'::0';
                     my $checked = '';                      my $checked = '';
                     if (@currcategories > 0) {                      if (@currcategories > 0) {
Line 9136  sub assign_categories_table { Line 9145  sub assign_categories_table {
                             $checked = ' checked="checked" ';                              $checked = ' checked="checked" ';
                         }                          }
                     }                      }
                     $output .= '<tr '.$css_class.'><td><span class="LC_nobreak">'.                      my $parent_title = $parent;
                                '<input type="checkbox" name="usecategory" value="'.                      if ($parent eq 'communities') {
                                $item.'"'.$checked.' />'.$parent.'</span>'.                          $parent_title = &mt('Communities');
                                '<input type="hidden" name="catname" value="'.$parent.'" /></td>';                      }
                       $table .= '<tr '.$css_class.'><td><span class="LC_nobreak">'.
                                 '<input type="checkbox" name="usecategory" value="'.
                                 $item.'"'.$checked.' />'.$parent_title.'</span>'.
                                 '<input type="hidden" name="catname" value="'.$parent.'" /></td>';
                     my $depth = 1;                      my $depth = 1;
                     push(@path,$parent);                      push(@path,$parent);
                     $output .= &assign_category_rows($itemcount,\@cats,$depth,$parent,\@path,\@currcategories);                      $table .= &assign_category_rows($itemcount,\@cats,$depth,$parent,\@path,\@currcategories);
                     pop(@path);                      pop(@path);
                     $output .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>';                      $table .= '</tr><tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr>';
                     $itemcount ++;                      $itemcount ++;
                 }                  }
                 $output .= &Apache::loncommon::end_data_table();                  if ($itemcount) {
                       $output = &Apache::loncommon::start_data_table().
                                 $table.
                                 &Apache::loncommon::end_data_table();
                   }
             }              }
         }          }
     }      }

Removed from v.1.692.4.23  
changed lines
  Added in v.1.692.4.24


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