'.&mt('Deleted setting for [_1]',
- ''.$displayname.'').'
';
+ $output .= '
'.&Apache::lonhtmlcommon::confirm_success(&mt('Deleted setting for [_1]',
+ ''.$displayname.'')).'
';
} else {
- $output .= '
'.&mt('[_1] set to [_2]',
+ $output .= '
'.&Apache::lonhtmlcommon::confirm_success(&mt('[_1] set to [_2]',
''.$displayname.'',
- "'$displayval'");
+ "'$displayval'"));
if ($key eq 'url') {
my $bkuptime=time;
$output .= (' 'x2).&mt('(Previous URL backed up)').': '.
@@ -1037,6 +1021,10 @@ sub store_changes {
$output .= &mt('An error occurred when removing course settings which are no longer in use.');
}
$output .= '';
+ } else {
+ foreach my $key (@delkeys) {
+ &Apache::lonnet::delenv('course.'.$cdom.'_'.$cnum.'.'.$key);
+ }
}
}
if (@need_env_update) {
@@ -1174,8 +1162,8 @@ sub get_course {
}
sub get_jscript {
- my ($cdom,$phase) = @_;
- my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom);
+ my ($cdom,$phase,$crstype) = @_;
+ my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype);
my ($jscript,$categorize_js);
my $stubrowse_js = &Apache::loncommon::studentbrowser_javascript();
my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset');
@@ -1294,14 +1282,14 @@ sub print_courseinfo {
if (ref($cathash) eq 'HASH') {
$categoriesform =
&Apache::loncommon::assign_categories_table($cathash,
- $settings->{'categories'})."\n";
+ $settings->{'categories'},$crstype)."\n";
}
}
if (!defined($categoriesform)) {
- $categoriesform = &mt('No categories defined for this domain');
+ $categoriesform = &mt('No categories defined in this domain.');
}
- my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom);
+ my ($can_toggle_cat,$can_categorize) = &can_modify_catsettings($cdom,$crstype);
my $replace;
if ($crstype eq 'Community') {
@@ -1319,6 +1307,7 @@ sub print_courseinfo {
'',
input => 'textbox',
size => '40',
+ advanced => 1
},
'description' => {
text => ''.&mt($itemtext->{'description'}).'',
@@ -1336,12 +1325,14 @@ sub print_courseinfo {
&mt('Coordinators included automatically'),
input => 'textbox',
size => '40',
+ advanced => 1
},
'rolenames' => {
text => ''.&mt($itemtext->{'rolenames'}).' '.
'('.$replace.')',
input => 'textbox',
size => '20',
+ advanced => 1
},
'externalsyllabus' => {
text => ''.&mt($itemtext->{'externalsyllabus'}).' ('.
@@ -1370,7 +1361,11 @@ sub print_courseinfo {
next if (!$can_categorize);
}
$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') {
$datatable .= &yesno_radio($item,$settings);
} elsif ($item eq 'cloners') {
@@ -1507,15 +1502,24 @@ sub new_cloners_dom_row {
}
sub can_modify_catsettings {
- my ($dom) = @_;
+ my ($dom,$crstype) = @_;
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
my ($can_toggle_cat,$can_categorize);
if (ref($domconf{'coursecategories'}) eq 'HASH') {
- if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
- $can_toggle_cat = 1;
- }
- if ($domconf{'coursecategories'}{'categorize'} eq 'crs') {
- $can_categorize = 1;
+ if ($crstype eq 'Community') {
+ if ($domconf{'coursecategories'}{'togglecatscomm'} eq 'comm') {
+ $can_toggle_cat = 1;
+ }
+ if ($domconf{'coursecategories'}{'categorizecomm'} eq 'comm') {
+ $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);
@@ -1531,7 +1535,13 @@ sub assign_course_categories {
if (ref($domconf{'coursecategories'}) eq 'HASH') {
$cathash = $domconf{'coursecategories'}{'cats'};
if (ref($cathash) eq 'HASH') {
- $hascats = 1;
+ foreach my $cat (keys(%{$cathash})) {
+ next if ($cat eq 'instcode::0');
+ unless ($crstype eq 'Community') {
+ next if ($cat eq 'communities::0');
+ }
+ $hascats ++;
+ }
}
}
my $catwin_js;
@@ -1597,15 +1607,20 @@ ENDSCRIPT
if ($hascats) {
my %currsettings =
&Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum);
- $categoriesform .= $assign.'
'.
- ' ';
+ my $cattable = &Apache::loncommon::assign_categories_table($cathash,
+ $currsettings{'categories'},$crstype);
+ if ($cattable eq '') {
+ $categoriesform .= &mt('No suitable categories defined for this course type in this domain.');
+ } else {
+ $categoriesform .= $assign.'
'.
+ ' ';
+ }
} else {
- $categoriesform .= &mt('No categories defined for this domain');
+ $categoriesform .= &mt('No categories defined in this domain.');
}
$r->print($start_page.$categoriesform.$end_page);
return;
@@ -1618,16 +1633,16 @@ sub print_localization {
}
my %items = (
languages => {
- text => &mt($itemtext->{'languages'}).' '.
- &mt("(will override user's preference)"),
+ text => ''.&mt($itemtext->{'languages'}).' '.
+ &mt("(overrides individual user preference)"),
input => 'selectbox',
},
timezone => {
- text => &mt($itemtext->{'timezone'}),
+ text => ''.&mt($itemtext->{'timezone'}).'',
input => 'selectbox',
},
datelocale => {
- text => &mt($itemtext->{'datelocale'}),
+ text => ''.&mt($itemtext->{'datelocale'}).'',
input => 'selectbox',
},
);
@@ -1736,16 +1751,20 @@ sub print_feedback {
my %sections = &Apache::loncommon::get_sections($cdom,$cnum);
my @sections = sort( { $a <=> $b } keys(%sections));
my %lt = &Apache::lonlocal::texthash (
- currone => 'Current recipient:',
- curmult => 'Current recipients:',
- add => 'Additional recipient:',
- del => 'Delete?',
- sec => 'Sections:',
+ currone => 'Current recipient:',
+ currmult => 'Current recipients:',
+ add => 'Additional recipient:',
+ del => 'Delete?',
+ sec => 'Sections:',
);
foreach my $item (@{$ordered}) {
$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}." (Custom text)",$count, "advanced");
+ }
if ($position eq 'top') {
my $includeempty = 0;
$datatable .= &user_table($cdom,$item,\@sections,
@@ -1768,7 +1787,7 @@ sub user_table {
} else {
my $num = 0;
my @curr = split(/,/,$currvalue);
- $output .= &Apache::loncommon::start_data_table();
+ $output .= '
';
my ($currusers);
foreach my $val (@curr) {
next if ($val eq '');
@@ -1799,24 +1818,23 @@ sub user_table {
$num ++;
}
if ($num) {
- $output .= &Apache::loncommon::start_data_table_row().
+ $output .= '