Diff for /loncom/interface/courseprefs.pm between versions 1.8.2.4 and 1.9

version 1.8.2.4, 2010/01/03 01:59:25 version 1.9, 2009/10/29 14:57:18
Line 101  sub handler { Line 101  sub handler {
                 date => 'Locale used for community calendar',                  date => 'Locale used for community calendar',
                 coco => 'Community Content',                  coco => 'Community Content',
                 copo => 'Community Policy',                  copo => 'Community Policy',
                 priv => 'Domain Coordinators in community',                  priv => 'Domain Coodinators in community',
                 defd => 'Default dates for member access',                  defd => 'Default dates for member access',
                 stuv => 'Member-viewable membership list options',                  stuv => 'Member-viewable membership list options',
                 stul => 'Member agreement needed to be listed',                  stul => 'Member agreement needed to be listed',
Line 126  sub handler { Line 126  sub handler {
                 date => 'Locale used for course calendar',                  date => 'Locale used for course calendar',
                 coco => 'Course Content',                  coco => 'Course Content',
                 copo => 'Course Policy',                  copo => 'Course Policy',
                 priv => 'Domain Coordinators in course',                  priv => 'Domain Coodinators in course',
                 defd => 'Default dates for student access',                  defd => 'Default dates for student access',
                 stuv => 'Student-viewable classlist options',                  stuv => 'Student-viewable classlist options',
                 stul => 'Student agreement needed to be listed',                  stul => 'Student agreement needed to be listed',
Line 332  sub handler { Line 332  sub handler {
                                                  \@prefs_order,\%prefs,\%values,                                                   \@prefs_order,\%prefs,\%values,
                                                   $cnum,undef,\@allitems);                                                    $cnum,undef,\@allitems);
     } elsif ($phase eq 'display') {      } elsif ($phase eq 'display') {
         my $jscript = &get_jscript($cdom,$phase,$crstype);          my $jscript = &get_jscript($cdom,$phase);
         my @allitems = &get_allitems(%prefs);          my @allitems = &get_allitems(%prefs);
         &Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context,          &Apache::lonconfigsettings::display_settings($r,$cdom,$phase,$context,
             \@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype);              \@prefs_order,\%prefs,\%values,undef,$jscript,\@allitems,$crstype);
Line 1174  sub get_course { Line 1174  sub get_course {
 }  }
   
 sub get_jscript {  sub get_jscript {
     my ($cdom,$phase,$crstype) = @_;      my ($cdom,$phase) = @_;
     my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype);      my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom);
     my ($jscript,$categorize_js);      my ($jscript,$categorize_js);
     my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript();      my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript();
     my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset');      my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset');
Line 1294  sub print_courseinfo { Line 1294  sub print_courseinfo {
         if (ref($cathash) eq 'HASH') {          if (ref($cathash) eq 'HASH') {
             $categoriesform =               $categoriesform = 
                 &Apache::loncommon::assign_categories_table($cathash,                  &Apache::loncommon::assign_categories_table($cathash,
                                                 $settings->{'categories'},$crstype)."\n";                                                  $settings->{'categories'})."\n";
         }          }
     }      }
     if (!defined($categoriesform)) {      if (!defined($categoriesform)) {
         $categoriesform = &mt('No categories defined in this domain.');          $categoriesform = &mt('No categories defined for this domain');
     }      }
   
     my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype);      my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom);
   
     my $replace;      my $replace;
     if ($crstype eq 'Community') {      if ($crstype eq 'Community') {
Line 1507  sub new_cloners_dom_row { Line 1507  sub new_cloners_dom_row {
 }  }
   
 sub can_modify_catsettings {  sub can_modify_catsettings {
     my ($dom,$crstype) = @_;      my ($dom) = @_;
     my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);      my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
     my ($can_toggle_cat,$can_categorize);      my ($can_toggle_cat,$can_categorize);
     if (ref($domconf{'coursecategories'}) eq 'HASH') {      if (ref($domconf{'coursecategories'}) eq 'HASH') {
         if ($crstype eq 'Community') {          if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
             if ($domconf{'coursecategories'}{'togglecatscomm'} eq 'comm') {              $can_toggle_cat = 1;
                 $can_toggle_cat = 1;          }
             }          if ($domconf{'coursecategories'}{'categorize'} eq 'crs') {
             if ($domconf{'coursecategories'}{'categorizecomm'} eq 'comm') {              $can_categorize = 1;
                 $can_categorize = 1;  
             }  
         } else {  
             if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {  
                 $can_toggle_cat = 1;  
             }  
             if ($domconf{'coursecategories'}{'categorize'} eq 'crs') {  
                 $can_categorize = 1;  
             }  
         }          }
     }      }
     return ($can_toggle_cat,$can_categorize);      return ($can_toggle_cat,$can_categorize);
Line 1540  sub assign_course_categories { Line 1531  sub assign_course_categories {
     if (ref($domconf{'coursecategories'}) eq 'HASH') {      if (ref($domconf{'coursecategories'}) eq 'HASH') {
         $cathash = $domconf{'coursecategories'}{'cats'};          $cathash = $domconf{'coursecategories'}{'cats'};
         if (ref($cathash) eq 'HASH') {          if (ref($cathash) eq 'HASH') {
             foreach my $cat (keys(%{$cathash})) {              $hascats = 1;
                 next if ($cat eq 'instcode::0');  
                 unless ($crstype eq 'Community') {  
                     next if ($cat eq 'communities::0');  
                 }  
                 $hascats ++;   
             }  
         }          }
     }      }
     my $catwin_js;      my $catwin_js;
Line 1612  ENDSCRIPT Line 1597  ENDSCRIPT
     if ($hascats) {      if ($hascats) {
         my %currsettings =          my %currsettings =
             &Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum);              &Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum);
         my $cattable = &Apache::loncommon::assign_categories_table($cathash,          $categoriesform .= $assign.'<br /><br />'.
                                        $currsettings{'categories'},$crstype);                             '<form name="chgcats" action="/adm/courseprefs" method="post">'."\n".
         if ($cattable eq '') {                             &Apache::loncommon::assign_categories_table($cathash,
             $categoriesform .= &mt('No suitable categories defined for this course type in this domain.');                                                          $currsettings{'categories'})."\n".
         } else {                             '<br /><input type="button" name="changes" value="'.
             $categoriesform .= $assign.'<br /><br />'.                             &mt('Copy to main window').'" '.
                                '<form name="chgcats" action="/adm/courseprefs" method="post">'."\n".                             'onclick="javascript:updateCategories()" /></form><br />';
                                $cattable."\n".  
                                '<br /><input type="button" name="changes" value="'.  
                                &mt('Copy to main window').'" '.  
                                'onclick="javascript:updateCategories()" /></form><br />';  
         }  
     } else {      } else {
         $categoriesform .= &mt('No categories defined in this domain.');          $categoriesform .= &mt('No categories defined for this domain');
     }      }
     $r->print($start_page.$categoriesform.$end_page);      $r->print($start_page.$categoriesform.$end_page);
     return;      return;
Line 1788  sub user_table { Line 1768  sub user_table {
     } else {      } else {
         my $num = 0;          my $num = 0;
         my @curr = split(/,/,$currvalue);          my @curr = split(/,/,$currvalue);
         $output .= '<table class="LC_nested_outer">';          $output .= &Apache::loncommon::start_data_table();
         my ($currusers);          my ($currusers);
         foreach my $val (@curr) {          foreach my $val (@curr) {
             next if ($val eq '');              next if ($val eq '');
Line 1819  sub user_table { Line 1799  sub user_table {
             $num ++;              $num ++;
         }          }
         if ($num) {          if ($num) {
             $output .= '<tr>'.              $output .= &Apache::loncommon::start_data_table_row().
                        '<td align="left"><i>';                         '<td align="left"><i>';
             if ($num > 1) {              if ($num > 1) {
                 $output .= $lt->{'currone'};                  $output .= $lt->{'currone'};
Line 1828  sub user_table { Line 1808  sub user_table {
             }              }
             $output .= '</i><br />'.              $output .= '</i><br />'.
                           '<table>'.$currusers.'</table></td>'.                            '<table>'.$currusers.'</table></td>'.
                           '</tr>';                            &Apache::loncommon::end_data_table_row();
         }          }
         $output .= '<tr>'.          $output .= &Apache::loncommon::start_data_table_row().
                   '<td align="left"><span class="LC_nobreak"><i>'.                    '<td align="left"><span class="LC_nobreak"><i>'.
                   $lt->{'add'}.'</i></span><br />'.                    $lt->{'add'}.'</i></span><br />'.
                   &select_recipient($item,$num,$cdom,$sections).                    &select_recipient($item,$num,$cdom,$sections).
                   '<input type="hidden" name="'.$item.'_total" value="'.$num.'" />'.                    '<input type="hidden" name="'.$item.'_total" value="'.$num.'" />'.
                   '</td></tr></table>';                    '</td>'.&Apache::loncommon::end_data_table_row().
                     &Apache::loncommon::end_data_table();
     }      }
     return $output;      return $output;
 }  }
Line 1846  sub select_recipient { Line 1827  sub select_recipient {
     my $selectlink =      my $selectlink =
         &Apache::loncommon::selectstudent_link('display',$item.'_uname_'.$num,          &Apache::loncommon::selectstudent_link('display',$item.'_uname_'.$num,
                                                $item.'_udom_'.$num,1);                                                 $item.'_udom_'.$num,1);
       my $css_class = ($num % 2)?'LC_even_row':'LC_odd_row';
     my $output =       my $output = 
         '<table><tr><td align="center">'.&mt('Username').'<br />'.          '<table><tr class="'.$css_class.'"><td align="center">'.&mt('Username').'<br />'.
         '<input type="text" name="'.$item.'_uname_'.$num.'" value="" /></td>'.          '<input type="text" name="'.$item.'_uname_'.$num.'" value="" /></td>'.
         '<td align="center">'.&mt('Domain').'<br />'.$domform.'</td>';          '<td align="center">'.&mt('Domain').'<br />'.$domform.'</td>';
     if (ref($sections) eq 'ARRAY') {      if (ref($sections) eq 'ARRAY') {
Line 1901  sub print_discussion { Line 1883  sub print_discussion {
     }      }
     my %items = (      my %items = (
         'plc.roles.denied' => {          'plc.roles.denied' => {
                    text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'plc.roles.denied'}).'</b>'.                     text => '<b>'.&mt($itemtext->{'plc.roles.denied'}).'</b>'.
                            &Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'.                             &Apache::loncommon::help_open_topic("Course_Disable_Discussion").
                            &mt('(role-based)'),                             &mt('(role-based)'),
                    input => 'checkbox',                     input => 'checkbox',
                  },                   },
Line 1914  sub print_discussion { Line 1896  sub print_discussion {
                  },                   },
   
         'pch.roles.denied'   => {          'pch.roles.denied'   => {
                    text => '<span class="LC_nobreak"><b>'.&mt($itemtext->{'pch.roles.denied'}).'</b>'.                     text => '<b>'.&mt($itemtext->{'pch.roles.denied'}).'</b>'.
                            &Apache::loncommon::help_open_topic("Course_Disable_Discussion").'</span><br />'.                             &Apache::loncommon::help_open_topic("Course_Disable_Discussion").'<br />'.
                            &mt('(role-based)'),                             &mt('(role-based)'),
                    input => 'checkbox',                     input => 'checkbox',
                  },                   },
Line 2221  sub print_grading { Line 2203  sub print_grading {
                    input => 'selectbox',                     input => 'selectbox',
                    options => {                     options => {
                                 standard => &mt('Standard: shows points'),                                  standard => &mt('Standard: shows points'),
                                 external => &mt('External: shows number of completed parts and totals'),                                  external => &mt('External: shows number of completed parts'),
                                 externalnototals => &mt('External: shows only number of completed parts'),  
                                 spreadsheet => &mt('Spreadsheet: (with link to detailed scores)'),                                   spreadsheet => &mt('Spreadsheet: (with link to detailed scores)'), 
                               },                                },
                    order => ['standard','external','externalnototals','spreadsheet'],                     order => ['standard','external','spreadsheet'],
                  },                   },
         'rndseed' => {          'rndseed' => {
                    text => '<b>'.&mt($itemtext->{'rndseed'}).'</b>'.                     text => '<b>'.&mt($itemtext->{'rndseed'}).'</b>'.
Line 2697  function getIndexByName(item) { Line 2678  function getIndexByName(item) {
 </script>  </script>
   
 ENDJS  ENDJS
     $output .= $currstr.'<table class="LC_nested_outer">';      $output .= $currstr.&Apache::loncommon::start_data_table();
     if (@curr > 0) {      if (@curr > 0) {
         for (my $i=0; $i<@curr; $i++) {          for (my $i=0; $i<@curr; $i++) {
             my $pos = $i+1;              my $pos = $i+1;
             $output .= '<tr>'.              $output .= &Apache::loncommon::start_data_table_row().
                        '<td align="left"><span class="LC_nobreak">'.                         '<td align="left"><span class="LC_nobreak">'.
                        &position_selector($pos,$i,$maxnum).&mt('Delete:').                         &position_selector($pos,$i,$maxnum).&mt('Delete:').
                        '<input type="checkbox" name="printfmthdr_del_'.$i.                         '<input type="checkbox" name="printfmthdr_del_'.$i.
Line 2715  ENDJS Line 2696  ENDJS
                            '<input type="textbox" name="printfmthdr_text_'.$i.'"'.                             '<input type="textbox" name="printfmthdr_text_'.$i.'"'.
                            ' value="'.$curr[$i].'" size="25" /></td>';                             ' value="'.$curr[$i].'" size="25" /></td>';
             }              }
             $output .= '</tr>';              $output .= &Apache::loncommon::end_data_table_row();
         }          }
     }      }
     my $pos = $currnum+1;       my $pos = $currnum+1; 
     $output .= '<tr>'.      $output .= &Apache::loncommon::start_data_table_row().
                '<td align="left"><span class="LC_nobreak">'.                 '<td align="left"><span class="LC_nobreak">'.
                &position_selector($pos,$currnum,$maxnum).                 &position_selector($pos,$currnum,$maxnum).
                '<b>'.&mt('New').'</b></span></td><td align="left">'.                 '<b>'.&mt('New').'</b></span></td><td align="left">'.
                &substitution_selector($currnum).'</td>'.                 &substitution_selector($currnum).'</td>'.
                '</tr>';                  &Apache::loncommon::end_data_table_row();
     $pos ++;      $pos ++;
     $currnum ++;      $currnum ++;
     $output .= '<tr>'.      $output .= &Apache::loncommon::start_data_table_row().
                '<td align="left"><span class="LC_nobreak">'.                 '<td align="left"><span class="LC_nobreak">'.
                &position_selector($pos,$currnum,$maxnum).                 &position_selector($pos,$currnum,$maxnum).
                '<b>'.&mt('New').'</b></span></td>'.                 '<b>'.&mt('New').'</b></span></td>'.
Line 2736  ENDJS Line 2717  ENDJS
                '" value="" size ="25" />'.                 '" value="" size ="25" />'.
                '<input type="hidden" name="printfmthdr_maxnum" value="'.                 '<input type="hidden" name="printfmthdr_maxnum" value="'.
                 $maxnum.'" /></td>'.                  $maxnum.'" /></td>'.
                '</tr>'.                 &Apache::loncommon::end_data_table_row().
                '</table>';                  &Apache::loncommon::end_data_table(); 
     return $output;      return $output;
 }  }
   

Removed from v.1.8.2.4  
changed lines
  Added in v.1.9


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