-Set Defaults for All Resources in $foldermap
-$showtitle
-Specifically for
-ENDMAPONE
+ my $tmp="";
if ($uname) {
my $person=&Apache::loncommon::plainname($uname,$udom);
- $r->print(&mt("User")." $uname \($person\) ".
- &mt('in')." \n");
+ $tmp.=&mt("User")." $uname \($person\) ".
+ &mt('in')." \n";
} else {
- $r->print("".&mt('all').' '.&mt('users in')." \n");
+ $tmp.="".&mt('all').' '.&mt('users in')." \n";
}
if ($cgroup) {
- $r->print(&mt("Group")." $cgroup".
- " ".&mt('of')." \n");
+ $tmp.=&mt("Group")." $cgroup".
+ " ".&mt('of')." \n";
$csec = '';
} elsif ($csec) {
- $r->print(&mt("Section")." $csec".
- " ".&mt('of')." \n");
+ $tmp.=&mt("Section")." $csec".
+ " ".&mt('of')." \n";
}
- $r->print("$coursename
");
- $r->print("
\n");
+ $r->print(''
+ .&mt('Set Defaults for All Resources in [_1]Specifically for [_2][_3]'
+ ,$foldermap.'
'.$showtitle.'
'
+ ,$tmp
+ ,''.$coursename.''
+ )
+ ."
\n"
+ );
#---------------------------------------------------------------- print table
$r->print('
');
$r->print(''.&mt('Parameter Name').' | ');
@@ -1916,7 +1917,7 @@ ENDMAPONE
\%type,\%display,$defbgone,$defbgtwo,$defbgthree,
$parmlev,$uname,$udom,$csec,$cgroup);
}
- $r->print("
---|
");
+ $r->print("
");
} # end each map
} # end of $parmlev eq map
#--------------------------------- Entry for parm level general (Course level)
@@ -2133,11 +2134,12 @@ sub crsenv {
&change_clone($value,\@oldcloner);
}
# Update environment and nohist_courseids.db
- if ($name eq 'description' || $name eq 'cloners') {
+ if (($name eq 'description') || ($name eq 'cloners') ||
+ ($name eq 'hidefromcat') || ($name eq 'categories')) {
if ($chome eq '') {
%crsinfo =
&Apache::lonnet::courseiddump($dom,'.',1,'.','.',
- $crs,undef,undef,'Course');
+ $crs,undef,undef,'.');
$chome = &Apache::lonnet::homeserver($crs,$dom);
}
}
@@ -2150,9 +2152,10 @@ sub crsenv {
$chome,'notime');
}
}
- if ($name eq 'cloners') {
+ if (($name eq 'cloners') || ($name eq 'hidefromcat') || ($name eq 'categories')) {
if (ref($crsinfo{$env{'request.course.id'}}) eq 'HASH') {
- $crsinfo{$env{'request.course.id'}}{'cloners'} = $value;
+ &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.'.$name => $value});
+ $crsinfo{$env{'request.course.id'}}{$name} = $value;
my $putresult =
&Apache::lonnet::courseidput($dom,\%crsinfo,
$chome,'notime');
@@ -2208,6 +2211,7 @@ sub crsenv {
my $SelectStyleFile=&mt('Select Style File');
my $SelectSpreadsheetFile=&mt('Select Spreadsheet File');
my $output='';
+ my $can_categorize;
if (! exists($values{'con_lost'})) {
my %descriptions=
('url' => ''.&mt('Top Level Map').'
'.
@@ -2338,13 +2342,33 @@ sub crsenv {
'texengine'
=> ''.&mt('Force all students in the course to use a specific math rendering engine.').'
'
- .'('.&mt('[_1], [_2] (Convert to Images), [_3] (Tex-to-HTML), or blank for student\'s preference','"jsMath"','"mimetex"','"tth"').')',
+ .'('.&mt('[_1], [_2] (Convert to Images), [_3] (TeX to HTML), or blank for student\'s preference','"jsMath"','"mimetex"','"tth"').')',
+ 'timezone'
+ => ''.&mt('Timezone in which the course takes place').'',
- );
- my @Display_Order = ('url','description','courseid','cloners','grading',
+ 'suppress_embed_prompt'
+ => ''.&mt('Suppress prompt to upload items referenced in a web page being uploaded to portfolio, when current role is student.').'
'.
+ ' ('.&mt('[_1] to suppress, anything else to not suppress','"yes"').')',
+ 'hidefromcat'
+ => ''.&mt('Exclude from course catalog').'
'.
+ ' ('.&mt('[_1] to exclude, anything else to include - included if assigned an institutional code, or manually catagorized','"yes"').')',
+ 'categories'
+ => ''.&mt('Categorize course').' '.
+ &mt('Display Categories').'',
+ );
+ my @Display_Order = ('url','description','courseid','cloners');
+ (my $can_toggle_cat,$can_categorize) = &can_modify_catsettings($dom);
+ if ($can_toggle_cat) {
+ push(@Display_Order,'hidefromcat');
+ }
+ if ($can_categorize) {
+ push(@Display_Order,'categories');
+ }
+ push (@Display_Order,('grading',
'externalsyllabus',
'default_xml_style','pageseparators',
- 'question.email','question.email.text','comment.email','comment.email.text','policy.email','policy.email.text',
+ 'question.email','question.email.text','comment.email',
+ 'comment.email.text','policy.email','policy.email.text',
'student_classlist_view',
'student_classlist_opt_in',
'student_classlist_portfiles',
@@ -2353,11 +2377,13 @@ sub crsenv {
'allow_limited_html_in_feedback',
'allow_discussion_post_editing',
'languages',
+ 'timezone',
'nothideprivileged',
'rndseed',
'receiptalg',
'problem_stream_switch',
'suppress_tries',
+ 'suppress_embed_prompt',
'default_paper_size',
'print_header_format',
'disable_receipt_display',
@@ -2371,8 +2397,7 @@ sub crsenv {
'texengine',
'disablesigfigs',
'disableexampointprint',
- 'task_messages','task_grading',
- );
+ 'task_messages','task_grading'));
foreach my $parameter (sort(keys(%values))) {
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {
if (! $descriptions{$parameter}) {
@@ -2397,6 +2422,13 @@ sub crsenv {
$values{$parameter},
$onchange).
'';
+ } elsif ($parameter eq 'timezone') {
+ my $includeempty = 1;
+ my $timezone = &Apache::lonlocal::gettimezone();
+ $output .= ''.
+ &Apache::loncommon::select_timezone($parameter.'_value',
+ $timezone,
+ $onchange,$includeempty).' | ';
} else {
$output .= ''.
&Apache::lonhtmlcommon::textbox($parameter.'_value',
@@ -2430,14 +2462,26 @@ sub crsenv {
my $Parameter=&mt('Parameter');
my $Value=&mt('Value');
my $Set=&mt('Set');
- my $browse_js=
- '';
-
+ 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();
@@ -2458,6 +2502,91 @@ $end_table
$end_page
ENDENV
}
+
+sub can_modify_catsettings {
+ my ($dom) = @_;
+ 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;
+ }
+ }
+ 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 = '';
+ if (document.chgcats.usecategory.length) {
+ for (var i=0; i 0) {
+ newcategories = newcategories.slice(0,-1);
+ }
+ } else {
+ if (document.chgcats.usecategory.checked == true) {
+ newcategories = document.chgcats.usecategory.value;
+ }
+ }
+ opener.document.envform.categories_value.value = newcategories;
+ opener.document.envform.categories_setparmval.checked = true;
+ alert("$alert");
+ self.close();
+ return;
+}
+
+
+ENDSCRIPT
+ } else {
+ my $onload;
+ }
+ 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;
+}
+
##################################################
# Overview mode
##################################################
@@ -4319,7 +4448,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) {
|