Diff for /loncom/interface/courseprefs.pm between versions 1.28.2.11 and 1.49.2.2

version 1.28.2.11, 2012/02/01 19:54:35 version 1.49.2.2, 2012/06/03 13:40:50
Line 215  use Apache::lonnet; Line 215  use Apache::lonnet;
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonhtmlcommon();  use Apache::lonhtmlcommon();
 use Apache::lonconfigsettings;  use Apache::lonconfigsettings;
   use Apache::lonparmset;
 use Apache::lonlocal;  use Apache::lonlocal;
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
   
Line 267  sub handler { Line 268  sub handler {
     my %lt;      my %lt;
     if ($crstype eq 'Community') {      if ($crstype eq 'Community') {
         %lt = (          %lt = (
                 conf => 'Community Configuration',                  conf => 'Community Settings',
                 edit => 'Edit Community Configuration',                  edit => 'Edit Community Settings',
                 gens => 'General community settings',                  gens => 'General community settings',
                 idnu => 'Community ID or number',                  idnu => 'Community ID or number',
                 desc => 'Community Description',                  desc => 'Community Description',
Line 286  sub handler { Line 287  sub handler {
                 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',
                 clas => 'Membership and Facilitator Listing',                  clas => 'Membership and facilitator listing',
                 priv => 'Privileged users (Domain Coordinators) in facilitator listing',                  priv => 'Privileged users (Domain Coordinators) in facilitator listing',
                 defc => 'Default Community Spreadsheet',                  defc => 'Default Community Spreadsheet',
                 defs => 'Default User Spreadsheet',                  defs => 'Default User Spreadsheet',
Line 294  sub handler { Line 295  sub handler {
               );                );
     } else {      } else {
         %lt = (          %lt = (
                 conf => 'Course Configuration',                  conf => 'Course Settings',
                 edit => 'Edit Course Configuration',                  edit => 'Edit Course Settings',
                 gens => 'General course settings',                  gens => 'General course settings',
                 idnu => 'Course ID or number',                  idnu => 'Course ID or number',
                 desc => 'Course Description',                  desc => 'Course Description',
Line 313  sub handler { Line 314  sub handler {
                 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',
                 clas => 'Classlists and Staff Listing',                  clas => 'Classlists and staff listing',
                 priv => 'Privileged users (Domain Coordinators) in staff listing',                  priv => 'Privileged users (Domain Coordinators) in staff listing',
                 defc => 'Default Course Spreadsheet',                  defc => 'Default Course Spreadsheet',
                 defs => 'Default Student Spreadsheet',                  defs => 'Default Student Spreadsheet',
Line 338  sub handler { Line 339  sub handler {
   
     if ($phase eq 'releaseinfo') {      if ($phase eq 'releaseinfo') {
         my $loncaparev = $env{'course.'.$cid.'.internal.releaserequired'};          my $loncaparev = $env{'course.'.$cid.'.internal.releaserequired'};
         if ($loncaparev) {          if ($loncaparev) { 
             &display_loncaparev_constraints($r,$navmap,$loncaparev,$crstype);              &display_loncaparev_constraints($r,$navmap,$loncaparev,$crstype);
             return OK;              return OK;
         }          }
Line 352  sub handler { Line 353  sub handler {
     my %prefs = (      my %prefs = (
         'courseinfo' =>          'courseinfo' =>
                    { text => $lt{'gens'},                     { text => $lt{'gens'},
                      help => 'Course_Environment',                       help => 'Course_Prefs_General',
                      header => [{col1 => 'Setting',  
                                  col2 => 'Value'}],  
                      ordered => ['owner','co-owners','loncaparev','description',                       ordered => ['owner','co-owners','loncaparev','description',
                                  'courseid','categories','hidefromcat',                                   'courseid','categories','hidefromcat',
                                  'externalsyllabus','cloners','url','rolenames'],                                   'externalsyllabus','cloners','url','rolenames'],
Line 373  sub handler { Line 372  sub handler {
                                  },                                   },
                     },                      },
         'localization' =>          'localization' =>
                     { text => 'Language and Time Localization',                      { text => 'Language and time localization',
                       help => 'Course_Environment',                        help => 'Course_Prefs_Language',
                       header => [{col1 => 'Setting',  
                                   col2 => 'Value',}],  
                       ordered => ['languages','timezone','datelocale'],                        ordered => ['languages','timezone','datelocale'],
                       itemtext => {                        itemtext => {
                                     languages  => 'Languages used',                                      languages  => 'Languages used',
Line 386  sub handler { Line 383  sub handler {
                     },                      },
         'feedback' =>          'feedback' =>
                     { text => 'Feedback messages',                      { text => 'Feedback messages',
                       help => 'Course_Environment',                        help => 'Course_Prefs_Feedback',
                       header => [{col1 => 'Questions about:',                        header => [{col1 => 'Questions about:',
                                   col2 => 'Recipients'},                                    col2 => 'Recipients'}],
                                  {col1 => 'Questions about:',  
                                   col2 => 'Custom Text'}],  
                       ordered => ['question.email','comment.email','policy.email'],                        ordered => ['question.email','comment.email','policy.email'],
                       itemtext => {                        itemtext => {
                                      'question.email' => 'Resource Content',                                       'question.email' => 'Resource Content',
Line 400  sub handler { Line 395  sub handler {
                     },                      },
         'discussion' =>          'discussion' =>
                     { text => 'Discussion and Chat',                      { text => 'Discussion and Chat',
                       help => 'Course_Environment',                        help => 'Course_Prefs_Discussions',
                       ordered => ['pch.roles.denied','pch.users.denied',                        ordered => ['pch.roles.denied','pch.users.denied',
                                   'plc.roles.denied','plc.users.denied',                                    'plc.roles.denied','plc.users.denied',
                                   'allow_limited_html_in_feedback',                                    'allow_limited_html_in_feedback',
Line 416  sub handler { Line 411  sub handler {
                     },                      },
         'classlists' =>          'classlists' =>
                    { text => $lt{'clas'},                     { text => $lt{'clas'},
                      help => 'Course_Environment',                       help => 'Course_Prefs_Classlists',
                      header => [{col1 => 'Type',                       header => [{col1 => 'Type',
                                  col2 => $lt{'defd'}},                                   col2 => $lt{'defd'}},
                                 {col1 => 'Setting',                                  {col1 => 'Setting',
Line 438  sub handler { Line 433  sub handler {
                    },                     },
         'appearance' =>          'appearance' =>
                    { text => 'Display of resources ',                     { text => 'Display of resources ',
                      help => 'Course_Environment',                       help => 'Course_Prefs_Display',
                      header => [{col1 => 'Setting',  
                                  col2 => 'Value',}],  
                      ordered => ['default_xml_style','pageseparators',                       ordered => ['default_xml_style','pageseparators',
                                  'disable_receipt_display','texengine',                                   'disable_receipt_display','texengine',
                                  'tthoptions'],                                   'tthoptions'],
Line 454  sub handler { Line 447  sub handler {
                   },                    },
         'grading' =>          'grading' =>
                   { text => 'Grading',                    { text => 'Grading',
                     help => 'Course_Environment',                      help => 'Course_Prefs_Grading',
                     header => [{col1 => 'Setting',  
                                 col2 => 'Value',}],  
                     ordered => ['grading','rndseed',                      ordered => ['grading','rndseed',
                                 'receiptalg','disablesigfigs'],                                  'receiptalg','disablesigfigs'],
                     itemtext => {                      itemtext => {
Line 469  sub handler { Line 460  sub handler {
                   },                    },
         'printouts' =>          'printouts' =>
                   { text => 'Printout generation',                    { text => 'Printout generation',
                     help => 'Course_Environment',                      help => 'Course_Prefs_Printouts',
                     header => [{col1 => 'Setting',  
                                 col2 => 'Value',}],  
                     ordered => ['problem_stream_switch','suppress_tries',                      ordered => ['problem_stream_switch','suppress_tries',
                                 'default_paper_size','print_header_format',                                  'default_paper_size','print_header_format',
                                 'disableexampointprint'],                                  'disableexampointprint'],
Line 486  sub handler { Line 475  sub handler {
                   },                    },
         'spreadsheet' =>          'spreadsheet' =>
                   { text => 'Spreadsheets',                    { text => 'Spreadsheets',
                     help => 'Course_Environment',                      help => 'Course_Prefs_Spreadsheet',
                     header => [{col1 => 'Setting',  
                                 col2 => 'Value'}],  
                     ordered => ['spreadsheet_default_classcalc',                      ordered => ['spreadsheet_default_classcalc',
                                 'spreadsheet_default_studentcalc',                                  'spreadsheet_default_studentcalc',
                                 'spreadsheet_default_assesscalc','hideemptyrows'],                                  'spreadsheet_default_assesscalc','hideemptyrows'],
Line 501  sub handler { Line 488  sub handler {
                   },                    },
         'bridgetasks' =>          'bridgetasks' =>
                   { text => 'Bridge tasks',                    { text => 'Bridge tasks',
                     help => 'Course_Environment',                      help => 'Course_Prefs_Bridgetasks',
                     header => [{col1 => 'Setting',  
                                 col2 => 'Value'}],  
                     ordered => ['task_messages','task_grading',                      ordered => ['task_messages','task_grading',
                                 'suppress_embed_prompt'],                                  'suppress_embed_prompt'],
                     itemtext => {                      itemtext => {
Line 514  sub handler { Line 499  sub handler {
                   },                    },
         'other' =>          'other' =>
                   { text => 'Other settings',                    { text => 'Other settings',
                     help => 'Course_Environment',                      help => 'Course_Prefs_Other',
                     header => [ {col1 => 'Item',                      header => [ {col1 => 'Item',
                                  col2 => 'Value',                                   col2 => 'Value',
                               }],                                }],
Line 524  sub handler { Line 509  sub handler {
         my @allitems = &get_allitems(%prefs);          my @allitems = &get_allitems(%prefs);
         &Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context,          &Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context,
                                                  \@prefs_order,\%prefs,\%values,                                                   \@prefs_order,\%prefs,\%values,
                                                   $cnum,undef,\@allitems);                                                    $cnum,undef,\@allitems,'coursepref');
     } elsif ($phase eq 'display') {      } elsif ($phase eq 'display') {
         my $jscript = &get_jscript($cid,$cdom,$phase,$crstype);          my $jscript = &get_jscript($cid,$cdom,$phase,$crstype);
         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,'coursepref');
     } else {      } else {
         &Apache::lonconfigsettings::display_choices($r,$phase,$context,          &Apache::lonconfigsettings::display_choices($r,$phase,$context,
                                                     \@prefs_order,\%prefs);                                                      \@prefs_order,\%prefs,'coursepref');
     }      }
     return OK;      return OK;
 }  }
Line 569  sub print_config_box { Line 554  sub print_config_box {
         $output .= '          $output .= '
           <tr>            <tr>
            <td>             <td>
             <table class="LC_nested">';              <table class="LC_nested">';   
         if (exists $item->{'header'}->[0]->{'col1'} ||           if (exists $item->{'header'}->[0]->{'col1'} || 
             exists $item->{'header'}->[0]->{'col2'}) {              exists $item->{'header'}->[0]->{'col2'}) {
  $output .= '             $output .= '          
Line 589  sub print_config_box { Line 574  sub print_config_box {
           </td>            </td>
          </tr>           </tr>
          <tr>           <tr>
            <td>            <td>
             <table class="LC_nested">              <table class="LC_nested">
              <tr class="LC_info_row">               <tr class="LC_info_row">
               <td class="LC_left_item">'.&mt($item->{'header'}->[1]->{'col1'}).'</td>';                <td class="LC_left_item">'.&mt($item->{'header'}->[1]->{'col1'}).'</td>';
Line 605  sub print_config_box { Line 590  sub print_config_box {
           <tr>            <tr>
            <td>             <td>
             <table class="LC_nested">';              <table class="LC_nested">';
             if (exists $item->{'header'}->[0]->{'col1'} ||               if (exists $item->{'header'}->[2]->{'col1'} || 
             exists $item->{'header'}->[0]->{'col2'}) {              exists $item->{'header'}->[2]->{'col2'}) {
  $output .= '             $output .= '          
  <tr class="LC_info_row">   <tr class="LC_info_row">
   <td class="LC_left_item">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>    <td class="LC_left_item">'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
   <td class="LC_right_item">'.&mt($item->{'header'}->[0]->{'col2'}).'</td>    <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>
  </tr>';   </tr>';
             }          }
         }          }
     } else {      } else {
         $output .= '          $output .= '
Line 680  sub process_changes { Line 665  sub process_changes {
                     }                      }
                 }                  }
             } elsif (ref($item->{'ordered'}) eq 'ARRAY') {              } elsif (ref($item->{'ordered'}) eq 'ARRAY') {
                 @ordered = @{$item->{'ordered'}};                  if ($action eq 'courseinfo') {
                       my ($can_toggle_cat,$can_categorize) =
                           &can_modify_catsettings($cdom,$crstype);
                       foreach my $entry (@{$item->{'ordered'}}) {
                           next if (($entry eq 'hidefromcat') &&
                                    (!$can_toggle_cat));
                           next if (($entry eq 'categories') &&
                                    (!$can_categorize));
                           next if (($entry eq 'loncaparev') || 
                                   ($entry eq 'owner'));
                           push(@ordered,$entry);
                       }
                   } else {
                       @ordered = @{$item->{'ordered'}};
                   }
             }              }
             if (@ordered > 0) {              if (@ordered > 0) {
                 if ($action eq 'feedback') {                  if ($action eq 'feedback') {
Line 722  sub process_changes { Line 721  sub process_changes {
                     }                      }
                 } else {                  } else {
                     foreach my $entry (@ordered) {                      foreach my $entry (@ordered) {
                         next if (($entry eq 'loncaparev') || ($entry eq 'owner'));  
                         if ($entry eq 'cloners') {                          if ($entry eq 'cloners') {
                             if ($env{'form.cloners_all'}) {                              if ($env{'form.cloners_all'}) {
                                 $newvalues{$entry} = '*';                                  $newvalues{$entry} = '*';
Line 1717  sub print_courseinfo { Line 1715  sub print_courseinfo {
                            '</span>',                             '</span>',
                    input => 'textbox',                     input => 'textbox',
                    size  => '40',                     size  => '40',
                      advanced => 1
                  },                   },
         'description'  => {           'description'  => { 
                    text => '<b>'.&mt($itemtext->{'description'}).'</b>',                     text => '<b>'.&mt($itemtext->{'description'}).'</b>',
Line 1739  sub print_courseinfo { Line 1738  sub print_courseinfo {
                    text => '<b>'.&mt($itemtext->{'cloners'}).'</b><br />'.                     text => '<b>'.&mt($itemtext->{'cloners'}).'</b><br />'.
                            &mt('Owner and Coordinators included automatically'),                             &mt('Owner and Coordinators included automatically'),
                    input => 'textbox',                     input => 'textbox',
                    size  => '40',                     size  => '40'
                          },                           },
         'rolenames'  => {           'rolenames'  => { 
                    text  => '<b>'.&mt($itemtext->{'rolenames'}).'</b><br />'.                     text  => '<b>'.&mt($itemtext->{'rolenames'}).'</b><br />'.
                             '('.$replace.')',                              '('.$replace.')',
                    input => 'textbox',                     input => 'textbox',
                    size  => '20',                     size  => '20',
                      advanced => 1
                         },                          },
         'externalsyllabus' => {          'externalsyllabus' => {
                    text => '<b>'.&mt($itemtext->{'externalsyllabus'}).'</b><br />('.                     text => '<b>'.&mt($itemtext->{'externalsyllabus'}).'</b><br />('.
Line 1777  sub print_courseinfo { Line 1777  sub print_courseinfo {
             next if (!$can_categorize);              next if (!$can_categorize);
         }          }
         $count ++;          $count ++;
         $datatable .= &item_table_row_start($items{$item}{text},$count);          if (exists $items{$item}{advanced} && $items{$item}{advanced} == 1) {
           $datatable .= &item_table_row_start($items{$item}{text},$count,"advanced");
           } else {
           $datatable .= &item_table_row_start($items{$item}{text},$count);
           }
         if ($items{$item}{input} eq 'radio') {          if ($items{$item}{input} eq 'radio') {
             $datatable .= &yesno_radio($item,$settings);              $datatable .= &yesno_radio($item,$settings);
         } elsif ($item eq 'cloners') {          } elsif ($item eq 'cloners') {
Line 2126  sub display_loncaparev_constraints { Line 2130  sub display_loncaparev_constraints {
                              if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) {                               if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) {
                                  $middle = $1;                                   $middle = $1;
                                  $which = $2;                                   $which = $2;
                                  $scope = 'user';                                   $scope = 'user'; 
                              } elsif ($key =~ /^\Q$start\E(\[(\w+)\]\.)/) {                               } elsif ($key =~ /^\Q$start\E(\[(\w+)\]\.)/) {
                                  $middle = $1;                                   $middle = $1;
                                  $which = $2;                                   $which = $2;
Line 2321  sub display_loncaparev_constraints { Line 2325  sub display_loncaparev_constraints {
     my $mapres_header = '<h4>'.      my $mapres_header = '<h4>'.
                         &mt('Requirements for specific folders or resources').                          &mt('Requirements for specific folders or resources').
                         '</h4>';                          '</h4>';
     if ((keys(%toshow) > 0) || (keys(%byresource) > 0) ||      if ((keys(%toshow) > 0) || (keys(%byresource) > 0) || 
         (keys(%bysubmission) > 0) || (keys(%byresponsetype))) {          (keys(%bysubmission) > 0) || (keys(%byresponsetype))) {
         $output .= $mapres_header;          $output .= $mapres_header;
     }      }
Line 2336  sub display_loncaparev_constraints { Line 2340  sub display_loncaparev_constraints {
             &show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission,              &show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission,
                                 \%byresponsetype,\@scopeorder,\%lt);                                  \%byresponsetype,\@scopeorder,\%lt);
         }          }
         $r->print('<br /><br />');          $r->print('<br /><br />'); 
     } else {      } else {
         $r->print('<p class="LC_info">'.          $r->print('<p class="LC_info">'.
                   &mt('No version requirements from resource content or settings.').                    &mt('No version requirements from resource content or settings.').
                   '</p>');                    '</p>'); 
     }      }
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
     return;      return;
Line 2349  sub display_loncaparev_constraints { Line 2353  sub display_loncaparev_constraints {
 sub show_contents_view {  sub show_contents_view {
     my ($r,$navmap,$cid,$toshow,$bymap,$byresource,$bysubmission,$byresponsetype,      my ($r,$navmap,$cid,$toshow,$bymap,$byresource,$bysubmission,$byresponsetype,
         $scopeorder,$lt) = @_;          $scopeorder,$lt) = @_;
     if ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) ||      if ((keys(%{$toshow}) > 0) || (keys(%{$byresource}) > 0) || 
         (keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 0)) {          (keys(%{$bysubmission}) > 0) || (keys(%{$byresponsetype}) > 0)) {
         my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");          my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons");
         my $whitespace = '<img src="'.$location.'/whitespace_21.gif" alt="" />';          my $whitespace = '<img src="'.$location.'/whitespace_21.gif" alt="" />';
Line 2793  sub print_feedback { Line 2797  sub print_feedback {
   
     foreach my $item (@{$ordered}) {      foreach my $item (@{$ordered}) {
         $count ++;          $count ++;
         $datatable .= &item_table_row_start($items{$item}{text},$count);          if ($position eq 'top') {
           $datatable .= &item_table_row_start($items{$item}{text},$count);
           } else {
           $datatable .= &item_table_row_start($items{$item}{text}."<br/>(Custom text)",$count, "advanced");
           }
         if ($position eq 'top') {          if ($position eq 'top') {
             my $includeempty = 0;              my $includeempty = 0;
             $datatable .= &user_table($cdom,$item,\@sections,              $datatable .= &user_table($cdom,$item,\@sections,
                                       $settings->{$item},\%lt);                                        $settings->{$item},\%lt);
         } else {          } else {
             $datatable .= &Apache::lonhtmlcommon::textbox($item.'.text',              $datatable .= &Apache::lonhtmlcommon::textbox($item.'.text',
                               $settings->{$item.'.text'},$items{$item}{size});                                $settings->{$item.'.text'},$items{$item}{size});  
         }          }
         $datatable .= &item_table_row_end();          $datatable .= &item_table_row_end();
     }      }
Line 3271  sub print_grading { Line 3279  sub print_grading {
                                 '64bit5' => '64bit5',                                  '64bit5' => '64bit5',
                               },                                },
                    order => ['32bit','64bit','64bit2','64bit3','64bit4','64bit5'],                     order => ['32bit','64bit','64bit2','64bit3','64bit4','64bit5'],
                      advanced => 1
                  },                   },
         'receiptalg'  => {          'receiptalg'  => {
                    text => '<b>'.&mt($itemtext->{'receiptalg'}).'</b><br />'.                     text => '<b>'.&mt($itemtext->{'receiptalg'}).'</b><br />'.
Line 3282  sub print_grading { Line 3291  sub print_grading {
                                 receipt3 => 'receipt3',                                  receipt3 => 'receipt3',
                               },                                },
                    order => ['receipt','receipt2','receipt3'],                     order => ['receipt','receipt2','receipt3'],
                      advanced => 1
                  },                   },
         'disablesigfigs' => {          'disablesigfigs' => {
                    text => '<b>'.&mt($itemtext->{'disablesigfigs'}).'</b>',                     text => '<b>'.&mt($itemtext->{'disablesigfigs'}).'</b>',
Line 3553  sub make_item_rows { Line 3563  sub make_item_rows {
         my $count = 0;          my $count = 0;
         foreach my $item (@{$ordered}) {          foreach my $item (@{$ordered}) {
             $count ++;              $count ++;
             $datatable .= &item_table_row_start($items->{$item}{text},$count);              if (exists $items->{$item}{advanced} && $items->{$item}{advanced} == 1) {
                   $datatable .= &item_table_row_start($items->{$item}{text},$count,"advanced");
               } else {
                   $datatable .= &item_table_row_start($items->{$item}{text},$count);
               }
             if ($item eq 'nothideprivileged') {              if ($item eq 'nothideprivileged') {
                 $datatable .= &nothidepriv_row($cdom,$item,$settings,$crstype);                  $datatable .= &nothidepriv_row($cdom,$item,$settings,$crstype);
             } elsif ($item eq 'print_header_format') {              } elsif ($item eq 'print_header_format') {

Removed from v.1.28.2.11  
changed lines
  Added in v.1.49.2.2


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