--- loncom/interface/courseprefs.pm 2010/12/24 16:50:38 1.36 +++ loncom/interface/courseprefs.pm 2012/06/03 13:40:50 1.49.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set configuration settings for a course # -# $Id: courseprefs.pm,v 1.36 2010/12/24 16:50:38 raeburn Exp $ +# $Id: courseprefs.pm,v 1.49.2.2 2012/06/03 13:40:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -268,8 +268,8 @@ sub handler { my %lt; if ($crstype eq 'Community') { %lt = ( - conf => 'Community Configuration', - edit => 'Edit Community Configuration', + conf => 'Community Settings', + edit => 'Edit Community Settings', gens => 'General community settings', idnu => 'Community ID or number', desc => 'Community Description', @@ -287,7 +287,7 @@ sub handler { defd => 'Default dates for member access', stuv => 'Member-viewable membership list options', 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', defc => 'Default Community Spreadsheet', defs => 'Default User Spreadsheet', @@ -295,8 +295,8 @@ sub handler { ); } else { %lt = ( - conf => 'Course Configuration', - edit => 'Edit Course Configuration', + conf => 'Course Settings', + edit => 'Edit Course Settings', gens => 'General course settings', idnu => 'Course ID or number', desc => 'Course Description', @@ -314,7 +314,7 @@ sub handler { defd => 'Default dates for student access', stuv => 'Student-viewable classlist options', 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', defc => 'Default Course Spreadsheet', defs => 'Default Student Spreadsheet', @@ -353,7 +353,7 @@ sub handler { my %prefs = ( 'courseinfo' => { text => $lt{'gens'}, - help => 'Course_Environment', + help => 'Course_Prefs_General', ordered => ['owner','co-owners','loncaparev','description', 'courseid','categories','hidefromcat', 'externalsyllabus','cloners','url','rolenames'], @@ -372,8 +372,8 @@ sub handler { }, }, 'localization' => - { text => 'Language and Time Localization', - help => 'Course_Environment', + { text => 'Language and time localization', + help => 'Course_Prefs_Language', ordered => ['languages','timezone','datelocale'], itemtext => { languages => 'Languages used', @@ -383,7 +383,7 @@ sub handler { }, 'feedback' => { text => 'Feedback messages', - help => 'Course_Environment', + help => 'Course_Prefs_Feedback', header => [{col1 => 'Questions about:', col2 => 'Recipients'}], ordered => ['question.email','comment.email','policy.email'], @@ -395,7 +395,7 @@ sub handler { }, 'discussion' => { text => 'Discussion and Chat', - help => 'Course_Environment', + help => 'Course_Prefs_Discussions', ordered => ['pch.roles.denied','pch.users.denied', 'plc.roles.denied','plc.users.denied', 'allow_limited_html_in_feedback', @@ -411,7 +411,7 @@ sub handler { }, 'classlists' => { text => $lt{'clas'}, - help => 'Course_Environment', + help => 'Course_Prefs_Classlists', header => [{col1 => 'Type', col2 => $lt{'defd'}}, {col1 => 'Setting', @@ -433,7 +433,7 @@ sub handler { }, 'appearance' => { text => 'Display of resources ', - help => 'Course_Environment', + help => 'Course_Prefs_Display', ordered => ['default_xml_style','pageseparators', 'disable_receipt_display','texengine', 'tthoptions'], @@ -447,7 +447,7 @@ sub handler { }, 'grading' => { text => 'Grading', - help => 'Course_Environment', + help => 'Course_Prefs_Grading', ordered => ['grading','rndseed', 'receiptalg','disablesigfigs'], itemtext => { @@ -460,10 +460,10 @@ sub handler { }, 'printouts' => { text => 'Printout generation', - help => 'Course_Environment', + help => 'Course_Prefs_Printouts', ordered => ['problem_stream_switch','suppress_tries', 'default_paper_size','print_header_format', - 'disableexampointprint','canuse_pdfforms'], + 'disableexampointprint'], itemtext => { problem_stream_switch => 'Allow problems to be split over pages', suppress_tries => 'Suppress number of tries in printing', @@ -475,7 +475,7 @@ sub handler { }, 'spreadsheet' => { text => 'Spreadsheets', - help => 'Course_Environment', + help => 'Course_Prefs_Spreadsheet', ordered => ['spreadsheet_default_classcalc', 'spreadsheet_default_studentcalc', 'spreadsheet_default_assesscalc','hideemptyrows'], @@ -488,7 +488,7 @@ sub handler { }, 'bridgetasks' => { text => 'Bridge tasks', - help => 'Course_Environment', + help => 'Course_Prefs_Bridgetasks', ordered => ['task_messages','task_grading', 'suppress_embed_prompt'], itemtext => { @@ -499,7 +499,7 @@ sub handler { }, 'other' => { text => 'Other settings', - help => 'Course_Environment', + help => 'Course_Prefs_Other', header => [ {col1 => 'Item', col2 => 'Value', }], @@ -509,15 +509,15 @@ sub handler { my @allitems = &get_allitems(%prefs); &Apache::lonconfigsettings::make_changes($r,$cdom,$phase,$context, \@prefs_order,\%prefs,\%values, - $cnum,undef,\@allitems); + $cnum,undef,\@allitems,'coursepref'); } elsif ($phase eq 'display') { my $jscript = &get_jscript($cid,$cdom,$phase,$crstype); my @allitems = &get_allitems(%prefs); &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 { &Apache::lonconfigsettings::display_choices($r,$phase,$context, - \@prefs_order,\%prefs); + \@prefs_order,\%prefs,'coursepref'); } return OK; } @@ -544,11 +544,16 @@ sub print_config_box { my $itemtext = $item->{'itemtext'}; my $rowtotal = 0; my $output = - '
'. + &mt($item->{text}).' '. + &Apache::loncommon::help_open_topic($item->{'help'}).' | '."\n". + '|||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
+ |||||||||||||||||||||||||||||||||
|
+ |||||||||||||||||||||||||||||||||
'; return ($output,$rowtotal); } @@ -648,7 +665,21 @@ sub process_changes { } } } 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 ($action eq 'feedback') { @@ -690,7 +721,6 @@ sub process_changes { } } else { foreach my $entry (@ordered) { - next if (($entry eq 'loncaparev') || ($entry eq 'owner')); if ($entry eq 'cloners') { if ($env{'form.cloners_all'}) { $newvalues{$entry} = '*'; @@ -1346,9 +1376,9 @@ sub store_changes { $output .= ''; } else { if ($crstype eq 'Community') { - $output = &mt('No changes made to community settings.'); + $output .= &mt('No changes made to community settings.'); } else { - $output = &mt('No changes made to course settings.'); + $output .= &mt('No changes made to course settings.'); } } } @@ -1708,8 +1738,7 @@ sub print_courseinfo { text => ''.&mt($itemtext->{'cloners'}).' '. &mt('Owner and Coordinators included automatically'), input => 'textbox', - size => '40', - advanced => 1 + size => '40' }, 'rolenames' => { text => ''.&mt($itemtext->{'rolenames'}).' '. @@ -1901,7 +1930,7 @@ sub print_courseinfo { my $showreqd; if ($loncaparev) { $showreqd = &mt('[_1] or newer',$loncaparev).' '. - &mt('Details').'', + &mt('Details').''; } else { $showreqd = &mt('No specific version required'); } @@ -2069,23 +2098,21 @@ sub display_loncaparev_constraints { my $cdom = $env{'course.'.$cid.'.domain'}; my $cnum = $env{'course.'.$cid.'.num'}; my $output; + my %lt = &Apache::lonlocal::texthash ( + 'all' => 'all', + 'section/group' => 'section/group', + 'user' => 'user', + ); my (%checkparms,%checkresponsetypes,%checkcrstypes,%anonsurvey,%randomizetry); &Apache::loncommon::build_release_hashes(\%checkparms,\%checkresponsetypes, \%checkcrstypes,\%anonsurvey,\%randomizetry); - -# my %paramstrings = -# ('string_questiontype' => -# [[ 'anonsurveycred', 'Anonymous Survey'], -# [ 'anonsurvey', 'Anonymous Survey'], -# [ 'randomizetry', 'New Randomization Each N Tries']] -# ); if (defined($checkcrstypes{$crstype})) { $output .= ' '.&mt('Course type: [_1] requires [_2] or newer',$crstype, $checkcrstypes{$crstype}).''; } my (%fromparam,%rowspan,%bymap,%byresource,@scopeorder,%toshow,%allmaps, %byresponsetype,%bysubmission); - @scopeorder = ('course','section/group','user'); + @scopeorder = ('all','section/group','user'); my $resourcedata = &Apache::lonparmset::readdata($cnum,$cdom); if (ref($resourcedata) eq 'HASH') { foreach my $key (keys(%{$resourcedata})) { @@ -2109,12 +2136,12 @@ sub display_loncaparev_constraints { $which = $2; $scope = 'section/group'; } else { - $scope = 'course'; + $scope = 'all'; } my $what="$stdname=$valname"; if ($key =~ /^\Q$start$middle\E\w+\.\Q$item\E$/) { $level = 'general'; - if ($scope eq 'course') { + if ($scope eq 'all') { if (ref($fromparam{$rev}{$scope}) eq 'ARRAY') { unless(grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}})) { push(@{$fromparam{$rev}{$scope}},$what); @@ -2135,7 +2162,7 @@ sub display_loncaparev_constraints { } elsif ($key =~ /^\Q$start$middle\E(.+)___\(all\).\w+\.\Q$item\E$/) { $level = 'folder'; $map = $1; - if ($scope eq 'course') { + if ($scope eq 'all') { if (ref($bymap{$map}{$rev}{$scope}) eq 'ARRAY') { unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}})) { push(@{$bymap{$map}{$rev}{$scope}},$what); @@ -2155,7 +2182,7 @@ sub display_loncaparev_constraints { } elsif ($key =~ /^\Q$start$middle\E(.+)\.\w+\.\Q$item\E$/) { $level = 'resource'; $resource = $1; - if ($scope eq 'course') { + if ($scope eq 'all') { if (ref($byresource{$resource}{$rev}{$scope}) eq 'ARRAY') { unless(grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}})) { push(@{$byresource{$resource}{$rev}{$scope}},$what); @@ -2194,7 +2221,7 @@ sub display_loncaparev_constraints { if ($newrow) { $output .= &Apache::loncommon::continue_data_table_row(); } - $output .= ' | '.$scope.' | '; + $output .= ''.$lt{$scope}.' | '; foreach my $which (sort(keys(%{$fromparam{$rev}{$scope}}))) { $output .= ''.$which.' | '.
join(' ',@{$fromparam{$rev}{$scope}{$which}}).' | ';
@@ -2205,7 +2232,7 @@ sub display_loncaparev_constraints {
if ($newrow) {
$output .= &Apache::loncommon::continue_data_table_row();
}
- $output .= ''.$scope.' | '. + $output .= ' | '.$lt{$scope}.' | '.
join(' ',@{$fromparam{$rev}{$scope}}).' | '.
&Apache::loncommon::end_data_table_row();
$newrow = 1;
@@ -2311,7 +2338,7 @@ sub display_loncaparev_constraints {
$r->print($output);
if (defined($navmap)) {
&show_contents_view($r,$navmap,$cid,\%toshow,\%bymap,\%byresource,\%bysubmission,
- \%byresponsetype,\@scopeorder);
+ \%byresponsetype,\@scopeorder,\%lt);
}
$r->print(''.$icon.' '.&mt('Main Course Documents').' | '); - &releases_by_map($r,$bymap,$topmap,$scopeorder); + &releases_by_map($r,$bymap,$topmap,$scopeorder,$lt); $r->print(&Apache::loncommon::end_data_table_row()); my $it=$navmap->getIterator(undef,undef,undef,1,1,undef); my $curRes; @@ -2377,7 +2405,7 @@ sub show_contents_view { } $r->print(&Apache::loncommon::start_data_table_row(). ''.$indent.$icon.' '.$title.' | '); - &releases_by_map($r,$bymap,$url,$scopeorder); + &releases_by_map($r,$bymap,$url,$scopeorder,$lt); $r->print(&Apache::loncommon::end_data_table_row()); } else { my $rowspan; @@ -2406,7 +2434,7 @@ sub show_contents_view { $r->print('
'.&mt('Setting - scope: [_1]',$scope).' | '); + $r->print('||
'.&mt('Setting - scope: [_1]',$lt->{$scope}).' | '); foreach my $which (sort(keys(%{$byresource->{$symb}{$rev}{$scope}}))) { $r->print(''.$which.' | '.
join(' ',@{$byresource->{$symb}{$rev}{$scope}{$which}}). @@ -2414,7 +2442,7 @@ sub show_contents_view { } $r->print(' |
'.&mt('Setting - scope: [_1]',$scope).' | '. + $r->print('||
'.&mt('Setting - scope: [_1]',$lt->{$scope}).' | '. ''.
join(' ',@{$byresource->{$symb}{$rev}{$scope}}).' |
'.&mt('Setting - scope: [_1]',$scope).' | '); + $r->print('||
'.&mt('Setting - scope: [_1]',$lt->{$scope}).' | '); foreach my $which (sort(keys(%{$bymap->{$url}{$rev}{$scope}}))) { $r->print(''.$which.' | '.
join(' ',@{$bymap->{$url}{$rev}{$scope}{$which}}). @@ -2480,7 +2508,7 @@ sub releases_by_map { } $r->print(' |
'.&mt('Setting - scope: [_1]',$scope). + $r->print(' | ||
'.&mt('Setting - scope: [_1]',$lt->{$scope}). ' | '.
join(' ',@{$bymap->{$url}{$rev}{$scope}}).' |