'.
join(' / ',split(/\//,$uri)).
' '.
- "$bighash{'title_'.$rid}");
+ " TARGET=_self>$title");
if ($thistitle) {
$r->print(' ('.$thistitle.')');
@@ -1158,7 +1293,7 @@ ENDTABLEHEADFOUR
&print_row($r,$_,\%part,\%name,$rid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
- $parmlev);
+ $parmlev,$uname,$udom,$csec);
}
}
}
@@ -1232,12 +1367,12 @@ ENDTABLEHEADFOUR
} # end loop through ids
#---------------------------------------------------- print header information
- my $foldermap=($maptitle=~/^uploaded/?'Folder':'Map');
+ my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map');
my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');
$r->print(<
-Set Defaults for All Resources in $foldermap
-$showtitle
+Set Defaults for All Resources in $foldermap
+$showtitle
Specifically for
ENDMAPONE
if ($uname) {
@@ -1245,25 +1380,28 @@ ENDMAPONE
('firstname','middlename','lastname','generation', 'id'));
my $person=$name{'firstname'}.' '.$name{'middlename'}.' '
.$name{'lastname'}.' '.$name{'generation'};
- $r->print("User $uname \($person\) in \n");
+ $r->print(&mt("User")." $uname \($person\) ".
+ &mt('in')." \n");
} else {
- $r->print("all users in \n");
+ $r->print("".&mt('all').' '.&mt('users in')." \n");
}
- if ($csec) {$r->print("Section $csec of \n")};
+ if ($csec) {$r->print(&mt("Section")." $csec ".
+ &mt('of')." \n")};
- $r->print("$coursename ");
- $r->print("\n");
+ $r->print("$coursename ");
+ $r->print("\n");
#---------------------------------------------------------------- print table
$r->print('');
- $r->print('Parameter Name | ');
- $r->print('Default Value | ');
- $r->print('Parameter in Effect | ');
+ $r->print(''.&mt('Parameter Name').' | ');
+ $r->print(''.&mt('Default Value').' | ');
+ $r->print(''.&mt('Parameter in Effect').' | ');
foreach (sort keys %name) {
+ $r->print('');
&print_row($r,$_,\%part,\%name,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
- $parmlev);
+ $parmlev,$uname,$udom,$csec);
# $r->print(" resource.$part{$_}.$name{$_},$symbp{$mapid} | \n");
}
$r->print(" ");
@@ -1314,32 +1452,33 @@ ENDMAPONE
} # end loop through ids
#---------------------------------------------------- print header information
+ my $setdef=&mt("Set Defaults for All Resources in Course");
$r->print(<
-Set Defaults for All Resources in Course
-$coursename
+$setdef
+$coursename
ENDMAPONE
if ($uname) {
my %name=&Apache::lonnet::userenvironment($udom,$uname,
('firstname','middlename','lastname','generation', 'id'));
my $person=$name{'firstname'}.' '.$name{'middlename'}.' '
.$name{'lastname'}.' '.$name{'generation'};
- $r->print(" User $uname \($person\) \n");
+ $r->print(" ".&mt("User")." $uname \($person\) \n");
} else {
- $r->print("ALL USERS \n");
+ $r->print(" ".&mt("ALL")." ".&mt("USERS")." \n");
}
- if ($csec) {$r->print("Section $csec\n")};
- $r->print("\n");
+ if ($csec) {$r->print(&mt("Section")." $csec\n")};
+ $r->print("\n");
#---------------------------------------------------------------- print table
$r->print('');
- $r->print('Parameter Name | ');
- $r->print('Default Value | ');
- $r->print('Parameter in Effect | ');
+ $r->print(''.&mt('Parameter Name').' | ');
+ $r->print(''.&mt('Default Value').' | ');
+ $r->print(''.&mt('Parameter in Effect').' | ');
foreach (sort keys %name) {
+ $r->print('');
&print_row($r,$_,\%part,\%name,$mapid,\%default,
- \%type,\%display,$defbgone,$defbgtwo,$parmlev);
+ \%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec);
# $r->print(" resource.$part{$_}.$name{$_},$symbp{$mapid} | \n");
}
$r->print(" ");
@@ -1358,7 +1497,7 @@ ENDMAPONE
=item crsenv
-Show course data and parameters. This is a large routine that should
+Show and set course data and parameters. This is a large routine that should
be simplified and shortened... someday.
Inputs: $r
@@ -1374,186 +1513,638 @@ sub crsenv {
my $setoutput='';
my $bodytag=&Apache::loncommon::bodytag(
'Set Course Environment Parameters');
- my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
- my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
-# -------------------------------------------------- Go through list of changes
- foreach (keys %ENV) {
- if ($_=~/^form\.(.+)\_setparmval$/) {
- my $name=$1;
- my $value=$ENV{'form.'.$name.'_value'};
- if ($name eq 'newp') {
- $name=$ENV{'form.newp_name'};
- }
- if ($name eq 'url') {
- $value=~s/^\/res\///;
- my $bkuptime=time;
- my @tmp = &Apache::lonnet::get
- ('environment',['url'],$dom,$crs);
- $setoutput.='Backing up previous URL: '.
- &Apache::lonnet::put
- ('environment',
- {'top level map backup '.$bkuptime => $tmp[1] },
- $dom,$crs).
- ' ';
- }
- if ($name =~ /^spreadsheet_default_(classcalc|
- studentcalc|
- assesscalc)$/x) {
- my $sheettype = $1;
- if ($sheettype eq 'classcalc') {
- # no need to do anything since viewing the sheet will
- # cause it to be updated.
- } elsif ($sheettype eq 'studentcalc') {
- # expire all the student spreadsheets
- &Apache::lonnet::expirespread('','','studentcalc');
- } else {
- # expire all the default assessment spreadsheets
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,
+ 'Edit Course Environment');
+ my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+
+ #
+ # Go through list of changes
+ foreach (keys %env) {
+ next if ($_!~/^form\.(.+)\_setparmval$/);
+ my $name = $1;
+ my $value = $env{'form.'.$name.'_value'};
+ if ($name eq 'newp') {
+ $name = $env{'form.newp_name'};
+ }
+ if ($name eq 'url') {
+ $value=~s/^\/res\///;
+ my $bkuptime=time;
+ my @tmp = &Apache::lonnet::get
+ ('environment',['url'],$dom,$crs);
+ $setoutput.=&mt('Backing up previous URL').': '.
+ &Apache::lonnet::put
+ ('environment',
+ {'top level map backup '.$bkuptime => $tmp[1] },
+ $dom,$crs).
+ ' ';
+ }
+ #
+ # Deal with modified default spreadsheets
+ if ($name =~ /^spreadsheet_default_(classcalc|
+ studentcalc|
+ assesscalc)$/x) {
+ my $sheettype = $1;
+ if ($sheettype eq 'classcalc') {
+ # no need to do anything since viewing the sheet will
+ # cause it to be updated.
+ } elsif ($sheettype eq 'studentcalc') {
+ # expire all the student spreadsheets
+ &Apache::lonnet::expirespread('','','studentcalc');
+ } else {
+ # expire all the assessment spreadsheets
+ # this includes non-default spreadsheets, but better to
+ # be safe than sorry.
+ &Apache::lonnet::expirespread('','','assesscalc');
+ # expire all the student spreadsheets
+ &Apache::lonnet::expirespread('','','studentcalc');
+ }
+ }
+ #
+ # Deal with the enrollment dates
+ if ($name =~ /^default_enrollment_(start|end)_date$/) {
+ $value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value');
+ }
+ # Get existing cloners
+ my @oldcloner = ();
+ if ($name eq 'cloners') {
+ my %clonenames=&Apache::lonnet::dump('environment',$dom,$crs,'cloners');
+ if ($clonenames{'cloners'} =~ /,/) {
+ @oldcloner = split/,/,$clonenames{'cloners'};
+ } else {
+ $oldcloner[0] = $clonenames{'cloners'};
+ }
+ }
+ #
+ # Let the user know we made the changes
+ if ($name && defined($value)) {
+ if ($name eq 'cloners') {
+ $value =~ s/^,//;
+ $value =~ s/,$//;
+ }
+ my $put_result = &Apache::lonnet::put('environment',
+ {$name=>$value},$dom,$crs);
+ if ($put_result eq 'ok') {
+ $setoutput.=&mt('Set').' '.$name.' '.&mt('to').' '.$value.'. ';
+ if ($name eq 'cloners') {
+ &change_clone($value,\@oldcloner);
}
+ # Flush the course logs so course description is immediately updated
+ if ($name eq 'description' && defined($value)) {
+ &Apache::lonnet::flushcourselogs();
+ }
+ } else {
+ $setoutput.=&mt('Unable to set').' '.$name.' '.&mt('to').
+ ' '.$value.' '.&mt('due to').' '.$put_result.'. ';
}
-
- if ($name) {
- $setoutput.='Setting '.$name.' to '.
- $value.': '.
- &Apache::lonnet::put
- ('environment',{$name=>$value},$dom,$crs).
- ' ';
- }
}
}
+# ------------------------- Re-init course environment entries for this session
+
+ &Apache::lonnet::coursedescription($env{'request.course.id'});
+
# -------------------------------------------------------- Get parameters again
my %values=&Apache::lonnet::dump('environment',$dom,$crs);
+ my $SelectStyleFile=&mt('Select Style File');
+ my $SelectSpreadsheetFile=&mt('Select Spreadsheet File');
my $output='';
if (! exists($values{'con_lost'})) {
my %descriptions=
- ('url' => 'Top Level Map '.
+ ('url' => ''.&mt('Top Level Map').' '.
'".
- 'Browse '.
- 'Modification may make assessment data '.
- 'inaccessible',
- 'description' => 'Course Description',
- 'courseid' => 'Course ID or number '.
- '(internal, optional)',
- 'default_xml_style' => 'Default XML Style File '.
+ &mt('Select Map').' '.
+ &mt('Modification may make assessment data inaccessible').
+ '',
+ 'description' => ''.&mt('Course Description').'',
+ 'courseid' => ''.&mt('Course ID or number').
+ ' '.
+ '('.&mt('internal').', '.&mt('optional').')',
+ 'cloners' => ''.&mt('Users allowed to clone course').' (user:domain,user:domain) '.&mt('Users with active Course Coordinator role in the course automatically have the right to clone it, and can be omitted from list.'),
+ 'grading' => ''.&mt('Grading').' '.
+ '"standard", "external", or "spreadsheet" '.&Apache::loncommon::help_open_topic('GradingOptions'),
+ 'default_xml_style' => ''.&mt('Default XML Style File').' '.
'Browse ",
- 'question.email' => 'Feedback Addresses for Resource Content '.
- 'Questions (user:domain,'.
+ ",'sty')\">$SelectStyleFile ",
+ 'question.email' => ''.&mt('Feedback Addresses for Resource Content Question').
+ ' (user:domain,'.
'user:domain(section;section;...;*;...),...)',
- 'comment.email' => 'Feedback Addresses for Course Content Comments '.
+ 'comment.email' => ''.&mt('Feedback Addresses for Course Content Comments').' '.
'(user:domain,user:domain(section;section;...;*;...),...)',
- 'policy.email' => 'Feedback Addresses for Course Policy'.
+ 'policy.email' => ''.&mt('Feedback Addresses for Course Policy').''.
' (user:domain,user:domain(section;section;...;*;...),...)',
- 'hideemptyrows' => 'Hide Empty Rows in Spreadsheets '.
- '("yes" for default hiding)',
- 'pageseparators' => 'Visibly Separate Items on Pages '.
- '("yes" for visible separation)',
- 'pch.roles.denied'=> 'Disallow Resource Discussion for '.
- 'Roles "st": '.
+ 'hideemptyrows' => ''.&mt('Hide Empty Rows in Spreadsheets').' '.
+ '('.&mt('"[_1]" for default hiding','yes').')',
+ 'pageseparators' => ''.&mt('Visibly Separate Items on Pages').' '.
+ '('.&mt('"[_1]" for visible separation','yes').', '.
+ &mt('changes will not show until next login').')',
+ 'student_classlist_view' => ''.&mt('Allow students to view classlist.').''.&mt('("all":students can view all sections,"section":students can only view their own section.blank or "disabled" prevents student view.'),
+
+ 'plc.roles.denied'=> ''.&mt('Disallow live chatroom use for Roles').
+ ' "st": '.
+ &mt('student').', "ta": '.
+ 'TA, "in": '.
+ &mt('instructor').'; '.&mt('role,role,...').') '.
+ Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
+ 'plc.users.denied' =>
+ ''.&mt('Disallow live chatroom use for Users').' '.
+ '(user:domain,user:domain,...)',
+
+ 'pch.roles.denied'=> ''.&mt('Disallow Resource Discussion for Roles').
+ ' "st": '.
'student, "ta": '.
'TA, "in": '.
'instructor; role,role,...) '.
Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
'pch.users.denied' =>
- 'Disallow Resource Discussion for Users '.
+ ''.&mt('Disallow Resource Discussion for Users').' '.
'(user:domain,user:domain,...)',
'spreadsheet_default_classcalc'
- => 'Default Course Spreadsheet '.
+ => ''.&mt('Default Course Spreadsheet').' '.
'Browse ",
+ ",'spreadsheet')\">$SelectSpreadsheetFile ",
'spreadsheet_default_studentcalc'
- => 'Default Student Spreadsheet '.
+ => ''.&mt('Default Student Spreadsheet').' '.
'Browse ",
+ ",'spreadsheet')\">$SelectSpreadsheetFile ",
'spreadsheet_default_assesscalc'
- => 'Default Assessment Spreadsheet '.
+ => ''.&mt('Default Assessment Spreadsheet').' '.
'Browse ",
+ ",'spreadsheet')\">$SelectSpreadsheetFile ",
'allow_limited_html_in_feedback'
- => 'Allow limited HTML in discussion posts '.
- '(Set value to yes to allow)',
+ => ''.&mt('Allow limited HTML in discussion posts').' '.
+ '('.&mt('Set value to "[_1]" to allow',"yes").')',
+ 'allow_discussion_post_editing'
+ => ''.&mt('Allow users to edit/delete their own discussion posts').' '.
+ '('.&mt('Set value to "[_1]" to allow',"yes").')',
'rndseed'
- => 'Random seed algorithm used '.
- 'Modifying this will make problems '.
- 'display different numbers or correct answer'
- );
- foreach (keys(%values)) {
- unless ($descriptions{$_}) {
- $descriptions{$_}=$_;
- }
+ => ''.&mt('Randomization algorithm used').' '.
+ ''.&mt('Modifying this will make problems').' '.
+ &mt('have different numbers and answers').'',
+ 'receiptalg'
+ => ''.&mt('Receipt algorithm used').' '.
+ &mt('This controls how receipt numbers are generated.'),
+ 'suppress_tries'
+ => ''.&mt('Suppress number of tries in printing').'('.
+ &mt('yes if supress').')',
+ 'problem_stream_switch'
+ => ''.&mt('Allow problems to be split over pages').' '.
+ ' ('.&mt('"[_1]" if allowed, anything else if not','yes').')',
+ 'default_paper_size'
+ => ''.&mt('Default paper type').' '.
+ ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'.
+ ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'.
+ ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',
+ 'anonymous_quiz'
+ => ''.&mt('Anonymous quiz/exam').' '.
+ ' ('.&mt('yes').' '.&mt('to avoid print students names').' )',
+ 'default_enrollment_start_date' => ''.&mt('Default beginning date when enrolling students').'',
+ 'default_enrollment_end_date' => ''.&mt('Default ending date when enrolling students').'',
+ 'nothideprivileged' => ''.&mt('Privileged users that should not be hidden on staff listings').''.
+ ' (user:domain,user:domain,...)',
+ 'languages' => ''.&mt('Languages used').'',
+ 'disable_receipt_display'
+ => ''.&mt('Disable display of problem receipts').' '.
+ ' ('.&mt('"[_1]" to disable, anything else if not','yes').')',
+ 'disablesigfigs'
+ => ''.&mt('Disable checking of Significant Figures').' '.
+ ' ('.&mt('"[_1]" to disable, anything else if not','yes').')',
+ 'tthoptions'
+ => ''.&mt('Default set of options to pass to tth/m when converting tex').''
+ );
+ my @Display_Order = ('url','description','courseid','cloners','grading',
+ 'default_xml_style','pageseparators',
+ 'question.email','comment.email','policy.email',
+ 'student_classlist_view',
+ 'plc.roles.denied','plc.users.denied',
+ 'pch.roles.denied','pch.users.denied',
+ 'allow_limited_html_in_feedback',
+ 'allow_discussion_post_editing',
+ 'languages',
+ 'nothideprivileged',
+ 'rndseed',
+ 'receiptalg',
+ 'problem_stream_switch',
+ 'suppress_tries',
+ 'default_paper_size',
+ 'disable_receipt_display',
+ 'spreadsheet_default_classcalc',
+ 'spreadsheet_default_studentcalc',
+ 'spreadsheet_default_assesscalc',
+ 'hideemptyrows',
+ 'default_enrollment_start_date',
+ 'default_enrollment_end_date',
+ 'tthoptions',
+ 'disablesigfigs'
+ );
+ foreach my $parameter (sort(keys(%values))) {
+ unless ($parameter =~ m/^internal\./) {
+ if (! $descriptions{$parameter}) {
+ $descriptions{$parameter}=$parameter;
+ push(@Display_Order,$parameter);
+ }
+ }
}
- foreach (sort keys %descriptions) {
+ foreach my $parameter (@Display_Order) {
+ my $description = $descriptions{$parameter};
# onchange is javascript to automatically check the 'Set' button.
my $onchange = 'onFocus="javascript:window.document.forms'.
- '[\'envform\'].elements[\''.$_.'_setparmval\']'.
+ "['envform'].elements['".$parameter."_setparmval']".
'.checked=true;"';
- $output.=''.$descriptions{$_}.' | '.
- ' | '.
- ' | '.
- ' '."\n";
+ $output .= ''.$description.' | ';
+ if ($parameter =~ /^default_enrollment_(start|end)_date$/) {
+ $output .= ''.
+ &Apache::lonhtmlcommon::date_setter('envform',
+ $parameter.'_value',
+ $values{$parameter},
+ $onchange).
+ ' | ';
+ } else {
+ $output .= ''.
+ &Apache::lonhtmlcommon::textbox($parameter.'_value',
+ $values{$parameter},
+ 40,$onchange).' | ';
+ }
+ $output .= ''.
+ &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').
+ ' | ';
+ $output .= " \n";
}
my $onchange = 'onFocus="javascript:window.document.forms'.
'[\'envform\'].elements[\'newp_setparmval\']'.
'.checked=true;"';
- $output.='Create New Environment Variable '.
+ $output.=' | '.&mt('Create New Environment Variable').' '.
' | '.
' | '.
' | ';
}
- $r->print(<
+ my %lt=&Apache::lonlocal::texthash(
+ 'par' => 'Parameter',
+ 'val' => 'Value',
+ 'set' => 'Set',
+ 'sce' => 'Set Course Environment'
+ );
+
+ my $Parameter=&mt('Parameter');
+ my $Value=&mt('Value');
+ my $Set=&mt('Set');
+ my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset');
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print(<
-
LON-CAPA Course Environment
$bodytag
-
|