'.
+ return '';
@@ -971,9 +1000,15 @@ sub extractResourceInformation {
#
my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
- my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
- my $parmdis = $display;
- $parmdis =~ s/\[Part.*$//g;
+ my ($display,$parmdis);
+ $display = &standard_parameter_names($name);
+ if ($display eq '') {
+ $display= &Apache::lonnet::metadata($srcf,$key.'.display');
+ $parmdis = $display;
+ $parmdis =~ s/\s*\[Part.*$//g;
+ } else {
+ $parmdis = &mt($display);
+ }
$$allparms{$name}=$parmdis;
if (ref($defkeytype)) {
$$defkeytype{$name}=
@@ -985,7 +1020,7 @@ sub extractResourceInformation {
# allparts is a hash of all parts
#
my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
- $$allparts{$part} = "Part: $part";
+ $$allparts{$part} = &mt('Part: [_1]',$part);
#
# Remember all keys going with this resource
#
@@ -1099,15 +1134,15 @@ sub parmmenu {
ENDSCRIPT
$r->print();
- $r->print("\n'
+ );
}
sub partmenu {
my ($r,$allparts,$psprt)=@_;
- $r->print('');
+ $r->print('');
$r->print('print(' selected="selected"') unless (@{$psprt});
$r->print('>'.&mt('All Parts').' ');
@@ -1160,21 +1220,18 @@ sub usermenu {
my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
&Apache::loncommon::selectstudent_link('parmform','uname','udom');
my $selscript=&Apache::loncommon::studentbrowser_javascript();
- my %lt=&Apache::lonlocal::texthash(
- 'se' => "Section",
- 'gr' => "Group",
- 'fu' => "For User",
- 'oi' => "or ID",
- 'ad' => "at Domain"
- );
+
my $sections='';
my %sectionhash = &Apache::loncommon::get_sections();
my $groups;
my %grouphash = &Apache::longroup::coursegroups();
+ my $g_s_header='';
+ my $g_s_footer='';
+
if (%sectionhash) {
- $sections=$lt{'se'}.': ';
}
+
if (%sectionhash && %grouphash && $parmlev ne 'full') {
- $sections .= ' or ';
+ $sections .= ' '.&mt('or').' ';
$sections .= qq|
';
-
+ my ($jscript,$categorize_js);
+ my $browse_js = &Apache::loncommon::browser_and_searcher_javascript('parmset');
+ if ($can_categorize) {
+ $categorize_js = <'."\n".
+ $browse_js."\n".$categorize_js."\n".'';
my $start_page =
&Apache::loncommon::start_page('Set Course Environment',
- $browse_js);
+ $jscript);
my $end_page =
&Apache::loncommon::end_page();
my $end_table=&Apache::loncommon::end_data_table();
@@ -2490,16 +2628,95 @@ $end_page
ENDENV
}
-sub can_toggle_cat {
+sub can_modify_catsettings {
my ($dom) = @_;
my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$dom);
- my $can_toggle_cat = '';
+ 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;
+ }
+ }
+ return ($can_toggle_cat,$can_categorize);
+}
+
+sub assign_course_categories {
+ my ($r) = @_;
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $hascats = 0;
+ my $cathash;
+ my %domconf = &Apache::lonnet::get_dom('configuration',['coursecategories'],$cdom);
+ if (ref($domconf{'coursecategories'}) eq 'HASH') {
+ $cathash = $domconf{'coursecategories'}{'cats'};
+ if (ref($cathash) eq 'HASH') {
+ $hascats = 1;
+ }
+ }
+ my $catwin_js;
+ if ($hascats) {
+ my $alert = &mt('Use \"Save\" in the main window to save course categories');
+ $catwin_js = <
+
+function updateCategories() {
+ var newcategories = '';
+ var unescapedcats = '';
+ if (document.chgcats.usecategory.length) {
+ for (var i=0; i 0) {
+ newcategories = newcategories.slice(0,-1);
+ }
+ if (unescapedcats.length > 0) {
+ unescapedcats = unescapedcats.slice(0,-3);
+ }
+ } else {
+ if (document.chgcats.usecategory.checked == true) {
+ newcategories = document.chgcats.usecategory.value;
+ unescapedcats = document.chgcats.catname.value;
+ }
+ }
+ opener.document.envform.categories_value.value = newcategories;
+ opener.document.envform.categories_display.value = unescapedcats;
+ opener.document.envform.categories_setparmval.checked = true;
+ alert("$alert");
+ self.close();
+ return;
+}
+
+
+ENDSCRIPT
+ } else {
+ my $onload;
}
- return $can_toggle_cat;
+ my $start_page =
+ &Apache::loncommon::start_page('Course Categories',$catwin_js,
+ {'only_body' => 1,});
+ my $end_page = &Apache::loncommon::end_page();
+ my $categoriesform = ''.&mt('Categorize Course').' ';
+ if ($hascats) {
+ my %currsettings =
+ &Apache::lonnet::get('environment',['hidefromcat','categories'],$cdom,$cnum);
+ $categoriesform .= &mt('Assign one or more categories to this course.').' '.
+ ' ';
+ } else {
+ $categoriesform .= &mt('No categories defined for this domain');
+ }
+ $r->print($start_page.$categoriesform.$end_page);
+ return;
}
##################################################
@@ -2775,15 +2992,16 @@ sub listdata {
}
if ($part ne $oldpart) {
$r->print(&tableend().
- "\n".&mt('Part').": $part ");
+ "\n".''.&mt('Part').": $part ");
$oldpart=$part;
}
#
# Ready to print
#
+ my $parmitem = &standard_parameter_names($name);
$r->print(&tablestart().
&Apache::loncommon::start_data_table_row().
- ''.&standard_parameter_names($name).
+ ' '.&mt($parmitem).
' ');
$foundkeys++;
@@ -2796,8 +3014,8 @@ sub listdata {
$$resourcedata{$thiskey},
'',1,'','').
' '.
-(($$resourcedata{$thiskey}!=0)?''.
-&mt('Shift all dates based on this date').' ':'').
+(($$resourcedata{$thiskey}!=0)?''.
+&mt('Shift all dates based on this date').' ':'').
&date_sanity_info($$resourcedata{$thiskey})
);
} elsif ($thistype eq 'date_interval') {
@@ -2810,7 +3028,7 @@ sub listdata {
$r->print(&default_selector($thiskey,$$resourcedata{$thiskey}));
}
$r->print(' ');
+ $thistype.'" />');
$r->print(' '.&Apache::loncommon::end_data_table_row());
}
}
@@ -3147,7 +3365,7 @@ ENDOVER
$r->print(''.
&mt('These parameters refer to resources that do not exist.').
' '.
- ' '.' '.
+ ' '.' '.
' ');
$r->print(&Apache::loncommon::start_data_table().
''.
@@ -3170,9 +3388,10 @@ ENDOVER
$display_value =
&Apache::lonlocal::locallocaltime($display_value);
}
+ my $parmitem = &standard_parameter_names($data{'parameter_name'});
+ $parmitem = &mt($parmitem);
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"',
- &standard_parameter_names($data{'parameter_name'}),
- $resourcedata->{$thiskey}));
+ $parmitem,$resourcedata->{$thiskey}));
$r->print(' ');
if ($data{'scope_type'} eq 'all') {
$r->print(&mt('All users'));
@@ -3200,7 +3419,7 @@ ENDOVER
}
}
$r->print(&Apache::loncommon::end_data_table().''.
- ' '.
+ ' '.
'
'.
&Apache::loncommon::end_page());
}
@@ -3586,21 +3805,21 @@ sub output_row {
my $multiple_checked;
my $single_checked;
if ($options =~ m/onlyone/) {
- $multiple_checked = "";
- $single_checked = " CHECKED ";
+ $multiple_checked = '';
+ $single_checked = ' checked="checked"';
} else {
- $multiple_checked = " CHECKED ";
- $single_checked = "";
+ $multiple_checked = ' checked="checked"';
+ $single_checked = '';
}
$output .= &Apache::loncommon::continue_data_table_row();
$output .= ''.(' ' x 10).'
-
- Student may select multiple choices from list ';
+
+ '.&mt('Student may select multiple choices from list').'';
$output .= &Apache::loncommon::end_data_table_row();
$output .= &Apache::loncommon::continue_data_table_row();
$output .= ''.(' ' x 10).'
- Student may select only one choice from list ';
+ '.&mt('Student may select only one choice from list').'';
$output .= &Apache::loncommon::end_data_table_row();
}
return ($output);
@@ -4063,7 +4282,6 @@ sub load_parameter_names {
close($config);
$standard_parms{'int_pos'} = 'Positive Integer';
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero';
- %standard_parms=&Apache::lonlocal::texthash(%standard_parms);
}
sub standard_parameter_names {
@@ -4177,15 +4395,18 @@ sub parm_change_log {
} else {
$makenewrow=1;
}
+ my $parmitem = &standard_parameter_names($parmname);
$output .=''.$realm.' '.$section.' '.
- &standard_parameter_names($parmname).' '.
+ &mt($parmitem).' '.
($part?&mt('Part: [_1]',$part):&mt('All Parts')).' ';
my $stillactive=0;
if ($parmlog{$id}{'delflag'}) {
$output .= &mt('Deleted');
} else {
if ($typeflag) {
- $output .= &mt('Type: [_1]',&standard_parameter_names($value));
+ my $parmitem = &standard_parameter_names($value);
+ $parmitem = &mt($parmitem);
+ $output .= &mt('Type: [_1]',$parmitem);
} else {
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what),
$uname,$udom,$issection,$issection,$courseopt);
@@ -4203,8 +4424,11 @@ sub parm_change_log {
}
$output .= ' ';
if ($stillactive) {
- my $title=&mt('Changed [_1]',&standard_parameter_names($parmname));
- my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription,
+ my $parmitem = &standard_parameter_names($parmname);
+ $parmitem = &mt($parmitem);
+ my $title=&mt('Changed [_1]',$parmitem);
+ my $description=&mt('Changed [_1] for [_2] to [_3]',
+ $parmitem,$realmdescription,
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value));
if (($uname) && ($udom)) {
$output .=
@@ -4363,7 +4587,9 @@ sub handler {
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
text=>"Shifting Dates"});
&date_shift_two($r);
- }
+ } elsif ($env{'form.action'} eq 'categorizecourse' && $parm_permission) {
+ &assign_course_categories($r);
+ }
} else {
# ----------------------------- Not in a course, or not allowed to modify parms
if ($exists) {