--- loncom/interface/lonparmset.pm 2008/01/22 22:37:18 1.389
+++ loncom/interface/lonparmset.pm 2008/11/17 16:57:06 1.415
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.389 2008/01/22 22:37:18 www Exp $
+# $Id: lonparmset.pm,v 1.415 2008/11/17 16:57:06 schafran Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -325,14 +325,31 @@ sub date_sanity_info {
my $crsprefix='course.'.$env{'request.course.id'}.'.';
if ($env{$crsprefix.'default_enrollment_end_date'}) {
if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) {
- $result.=' '.&mt('After course enrollment end!');
+ $result.='
'
+ .&mt('After course enrollment end!')
+ .'
';
}
}
if ($env{$crsprefix.'default_enrollment_start_date'}) {
if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) {
- $result.=' '.&mt('Before course enrollment start!');
+ $result.=''
+ .&mt('Before course enrollment start!')
+ .'
';
}
}
+# Preparation for additional warnings about dates in the past/future.
+# An improved, more context sensitive version is recommended,
+# e.g. warn for due and answer dates which are defined before the corresponding open date, etc.
+# if ($checkdate'
+# .'('.&mt('in the past').')'
+# .'';
+# }
+# if ($checkdate>time) {
+# $result.=''
+# .'('.&mt('in the future').')'
+# .'
';
+# }
return $result;
}
##################################################
@@ -551,27 +568,38 @@ sub valout {
} else {
if ($type eq 'date_interval') {
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
+ my @timer;
$year=$year-70;
$mday--;
if ($year) {
- $result.=$year.' yrs ';
+# $result.=&mt('[quant,_1,yr]',$year).' ';
+ push(@timer,&mt('[quant,_1,yr]',$year));
}
if ($mon) {
- $result.=$mon.' mths ';
+# $result.=&mt('[quant,_1,mth]',$mon).' ';
+ push(@timer,&mt('[quant,_1,mth]',$mon));
}
if ($mday) {
- $result.=$mday.' days ';
+# $result.=&mt('[quant,_1,day]',$mday).' ';
+ push(@timer,&mt('[quant,_1,day]',$mday));
}
if ($hour) {
- $result.=$hour.' hrs ';
+# $result.=&mt('[quant,_1,hr]',$hour).' ';
+ push(@timer,&mt('[quant,_1,hr]',$hour));
}
if ($min) {
- $result.=$min.' mins ';
+# $result.=&mt('[quant,_1,min]',$min).' ';
+ push(@timer,&mt('[quant,_1,min]',$min));
}
if ($sec) {
- $result.=$sec.' secs ';
+# $result.=&mt('[quant,_1,sec]',$sec).' ';
+ push(@timer,&mt('[quant,_1,sec]',$sec));
}
- $result=~s/\s+$//;
+# $result=~s/\s+$//;
+ if (!@timer) { # Special case: all entries 0 -> display "0 secs" intead of empty field to keep this field editable
+ push(@timer,&mt('[quant,_1,sec]',0));
+ }
+ $result.=join(", ",@timer);
} elsif (&isdateparm($type)) {
$result = &Apache::lonlocal::locallocaltime($value).
&date_sanity_info($value);
@@ -683,6 +711,15 @@ sub startpage {
my %loaditems = ('onunload' => "pclose()",
'onload' => "group_or_section('cgroup')",);
+ if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
+ && (!$env{'form.dis'})) || ($env{'form.symb'})) {
+ &Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters',
+ text=>"Problem Parameters"});
+ } else {
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
+ text=>"Table Mode",
+ help => 'Course_Setting_Parameters'});
+ }
my $start_page =
&Apache::loncommon::start_page('Set/Modify Course Parameters',
&page_js(),
@@ -973,7 +1010,7 @@ sub extractResourceInformation {
if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
my $parmdis = $display;
- $parmdis =~ s/\[Part.*$//g;
+ $parmdis =~ s/\s*\[Part.*$//g;
$$allparms{$name}=$parmdis;
if (ref($defkeytype)) {
$$defkeytype{$name}=
@@ -985,7 +1022,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
#
@@ -1010,7 +1047,7 @@ sub extractResourceInformation {
$$mapp{$mapid}=$$mapp{$id};
$$allmaps{$mapid}=$$mapp{$id};
if ($mapid eq '1') {
- $$maptitles{$mapid}='Main Course Documents';
+ $$maptitles{$mapid}=&mt('Main Course Documents');
} else {
$$maptitles{$mapid}=
&Apache::lonnet::gettitle($$mapp{$id});
@@ -1107,8 +1144,8 @@ ENDSCRIPT
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
$r->print(' checked');
}
- $r->print('>'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
- : $tempkey)
+ $r->print('>'.($$allparms{$tempkey}=~/\S/ ? &mt($$allparms{$tempkey})
+ : &mt($tempkey))
.'');
$cnt++;
if ($cnt==3) {
@@ -1116,28 +1153,53 @@ ENDSCRIPT
$cnt=0;
}
}
- $r->print('
-');
+ $r->print(''
+ .''
+ );
}
sub partmenu {
my ($r,$allparts,$psprt)=@_;
$r->print('');
$r->print('print(' selected') unless (@{$psprt});
+ $r->print(' selected="selected"') unless (@{$psprt});
$r->print('>'.&mt('All Parts').' ');
my %temphash=();
foreach (@{$psprt}) { $temphash{$_}=1; }
@@ -1147,7 +1209,7 @@ sub partmenu {
unless ($tempkey =~ /\./) {
$r->print('print(' selected');
+ $r->print(' selected="selected"');
}
$r->print('>'.$$allparts{$tempkey}.' ');
}
@@ -1160,21 +1222,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();
@@ -2424,17 +2591,110 @@ $start_page
$breadcrumbs
$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 = '';
+ 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;
+ }
+ 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
##################################################
@@ -2729,6 +2989,8 @@ sub listdata {
$$resourcedata{$thiskey},
'',1,'','').
' '.
+(($$resourcedata{$thiskey}!=0)?''.
+&mt('Shift all dates based on this date').' ':'').
&date_sanity_info($$resourcedata{$thiskey})
);
} elsif ($thistype eq 'date_interval') {
@@ -2798,7 +3060,7 @@ my %strings =
[ 'no', 'No' ]],
'string_problemstatus'
=> [[ 'yes', 'Yes' ],
- [ 'answer', 'Yes, and show correct answer if they exceed the maxium number of tries.' ],
+ [ 'answer', 'Yes, and show correct answer if they exceed the maximum number of tries.' ],
[ 'no', 'No, don\'t show correct/incorrect feedback.' ],
[ 'no_feedback_ever', 'No, show no feedback at all.' ]],
);
@@ -2842,13 +3104,21 @@ sub dateshift {
delete $data{$key};
}
}
+ my %storecontent=();
# go through all parameters and look for dates
foreach my $key (keys %data) {
if ($data{$key.'.type'}=~/^date_(start|end)$/) {
my $newdate=$data{$key}+$shift;
- &Apache::lonnet::put('resourcedata',{$key => $newdate},$dom,$crs);
+ $storecontent{$key}=$newdate;
}
}
+ my $reply=&Apache::lonnet::cput
+ ('resourcedata',\%storecontent,$dom,$crs);
+ if ($reply eq 'ok') {
+ &log_parmset(\%storecontent);
+ }
+ &Apache::lonnet::devalidatecourseresdata($crs,$dom);
+ return $reply;
}
sub newoverview {
@@ -2856,6 +3126,8 @@ sub newoverview {
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
+ text=>"Overview Mode"});
my $start_page = &Apache::loncommon::start_page('Set Parameters');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print(<'/adm/parmset?action=setoverview',
+ text=>"Overview Mode"});
my $start_page=&Apache::loncommon::start_page('Modify Parameters');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview');
$r->print(<'/adm/parmset?action=cleanparameters',
+ text=>"Clean Parameters"});
my $start_page=&Apache::loncommon::start_page('Clean Parameters');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean');
$r->print(<print(''.
&mt('These parameters refer to resources that do not exist.').
' '.
- ' '.' '.
+ ' '.' '.
' ');
$r->print(&Apache::loncommon::start_data_table().
''.
@@ -3123,11 +3399,60 @@ ENDOVER
}
}
$r->print(&Apache::loncommon::end_data_table().''.
- ' '.
+ ' '.
'
'.
&Apache::loncommon::end_page());
}
+sub date_shift_one {
+ my ($r) = @_;
+ my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
+ text=>"Shifting Dates"});
+ my $start_page=&Apache::loncommon::start_page('Shift Dates');
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
+ $r->print(<print('');
+ $r->print(&Apache::loncommon::end_page());
+}
+
+sub date_shift_two {
+ my ($r) = @_;
+ my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=dateshift1&timebase='.$env{'form.timebase'},
+ text=>"Shifting Dates"});
+ my $start_page=&Apache::loncommon::start_page('Shift Dates');
+ my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift');
+ $r->print(<print(&mt('Shifting all dates such that [_1] becomes [_2]',
+ &Apache::lonlocal::locallocaltime($env{'form.timebase'}),
+ &Apache::lonlocal::locallocaltime($timeshifted)));
+ my $delta=$timeshifted-$env{'form.timebase'};
+ &dateshift($delta);
+ $r->print(&Apache::loncommon::end_page());
+}
+
sub parse_key {
my ($key) = @_;
my %data;
@@ -3339,6 +3664,8 @@ sub header {
sub print_main_menu {
my ($r,$parm_permission)=@_;
#
+ $r->print(&header());
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager'));
$r->print(<
@@ -3350,84 +3677,88 @@ ENDMAINFORMHEAD
my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'});
my @menu =
- ( { divider=>'Settings for Your Course',
- },
- { text => 'Set Course Environment',
- action => 'crsenv',
- permission => $parm_permission,
- help => 'Course_Environment',
- },
- { text => 'Set Portfolio Metadata',
- action => 'setrestrictmeta',
- permission => $parm_permission,
- },
- { text => 'Manage Course Slots',
- url => '/adm/slotrequest?command=showslots',
- permission => $vgr,
- },
- { text => 'Reset Student Access Times',
- url => '/adm/helper/resettimes.helper',
- permission => $mgr,
- },
-
- { text => 'Set Parameter Setting Default Actions',
- action => 'setdefaults',
- permission => $parm_permission,
- },
- { divider => 'New and Existing Parameter Settings for Your Resources',
- },
- { text => 'Set/Modify Resource Parameters - Helper Mode',
- url => '/adm/helper/parameter.helper',
- permission => $parm_permission,
- help => 'Parameter_Helper',
- },
- { text => 'Set/Modify Resource Parameters - Overview Mode',
- action => 'newoverview',
- permission => $parm_permission,
- help => 'Parameter_Overview',
- },
- { text => 'Set/Modify Resource Parameters - Table Mode',
- action => 'settable',
- permission => $parm_permission,
- help => 'Table_Mode',
- },
- { divider => 'Existing Parameter Settings for Your Resources',
- },
- { text => 'Modify Resource Parameters - Overview Mode',
- action => 'setoverview',
- permission => $parm_permission,
- help => 'Parameter_Overview',
- },
- { text => 'Parameter Change Log and Course Blog Posting/User Notification',
- action => 'parameterchangelog',
- permission => $parm_permission,
- },
+ ( { categorytitle=>'Settings for Your Course',
+ items => [
+ { linktext => 'Set Course Environment',
+ url => '/adm/parmset?action=crsenv',
+ permission => $parm_permission,
+ help => 'Course_Environment',
+ },
+ { linktext => 'Set Portfolio Metadata',
+ url => '/adm/parmset?action=setrestrictmeta',
+ permission => $parm_permission,
+ },
+ { linktext => 'Manage Course Slots',
+ url => '/adm/slotrequest?command=showslots',
+ permission => $vgr,
+ },
+ { linktext => 'Reset Student Access Times',
+ url => '/adm/helper/resettimes.helper',
+ permission => $mgr,
+ },
+
+ { linktext => 'Set Parameter Setting Default Actions',
+ url => '/adm/parmset?action=setdefaults',
+ permission => $parm_permission,
+ }]},
+ { categorytitle => 'New and Existing Parameter Settings for Your Resources',
+ items => [
+ { linktext => 'Set/Modify Resource Parameters - Helper Mode',
+ url => '/adm/helper/parameter.helper',
+ permission => $parm_permission,
+ help => 'Parameter_Helper',
+ },
+ { linktext => 'Set/Modify Resource Parameters - Overview Mode',
+ url => '/adm/parmset?action=newoverview',
+ permission => $parm_permission,
+ help => 'Parameter_Overview',
+ },
+ { linktext => 'Set/Modify Resource Parameters - Table Mode',
+ url => '/adm/parmset?action=settable',
+ permission => $parm_permission,
+ help => 'Table_Mode',
+ }]},
+ { categorytitle => 'Existing Parameter Settings for Your Resources',
+ items => [
+ { linktext => 'Modify Resource Parameters - Overview Mode',
+ url => '/adm/parmset?action=setoverview',
+ permission => $parm_permission,
+ help => 'Parameter_Overview',
+ },
+ { linktext => 'Parameter Change Log and Course Blog Posting/User Notification',
+ url => '/adm/parmset?action=parameterchangelog',
+ permission => $parm_permission,
+ }]}
);
- my $menu_html = '';
- foreach my $menu_item (@menu) {
- if ($menu_item->{'divider'}) {
- $menu_html .= ''.&mt($menu_item->{'divider'}).' ';
- next;
- }
- next if (! $menu_item->{'permission'});
- $menu_html.='';
- $menu_html.='';
- if (exists($menu_item->{'help'})) {
- $menu_html.=
- &Apache::loncommon::help_open_topic($menu_item->{'help'});
- }
- $menu_html.='
'.$/;
- }
- $r->print($menu_html);
+#---- Remove when done ----
+# my $menu_html = '';
+# foreach my $menu_item (@menu) {
+# if ($menu_item->{'categorytitle'}) {
+# $menu_html .= ''.&mt($menu_item->{'categorytitle'}).' ';
+# next;
+# }
+# next if (! $menu_item->{'permission'});
+# $menu_html.='';
+# $menu_html.='';
+# if (exists($menu_item->{'help'})) {
+# $menu_html.=
+# &Apache::loncommon::help_open_topic($menu_item->{'help'});
+# }
+# $menu_html.='
'.$/;
+# }
+# --------------------------
+
+ $r->print(&Apache::lonhtmlcommon::generate_menu(@menu));
return;
}
+
### Set portfolio metadata
sub output_row {
my ($r, $field_name, $field_text, $added_flag) = @_;
@@ -3489,6 +3820,8 @@ sub order_meta_fields {
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
$r->print(&Apache::loncommon::start_page('Order Metadata Fields'));
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',
+ text=>"Add Metadata Field"});
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/parmset?action=setrestrictmeta",
text=>"Restrict Metadata"},
@@ -3528,7 +3861,7 @@ sub order_meta_fields {
my $ordered_fields = join ",", @neworder;
my $put_result = &Apache::lonnet::put('environment',
{'metadata.addedorder'=>$ordered_fields},$dom,$crs);
- &Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields);
+ &Apache::lonnet::appenv({'course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields});
}
my $fields = &get_added_meta_fieldnames($env{'request.course.id'});
my $ordered_fields;
@@ -3574,6 +3907,8 @@ sub continue {
}
sub addmetafield {
my ($r)=@_;
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',
+ text=>"Add Metadata Field"});
$r->print(&Apache::loncommon::start_page('Add Metadata Field'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field'));
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -3624,6 +3959,8 @@ sub setrestrictmeta {
my $output;
my $item_num;
my $put_result;
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta',
+ text=>"Restrict Metadata"});
$r->print(&Apache::loncommon::start_page('Restrict Metadata'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata'));
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
@@ -3731,6 +4068,8 @@ sub get_deleted_meta_fieldnames {
sub defaultsetter {
my ($r) = @_;
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',
+ text=>"Set Defaults"});
my $start_page =
&Apache::loncommon::start_page('Parameter Setting Default Actions');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults');
@@ -3963,6 +4302,8 @@ sub standard_parameter_names {
sub parm_change_log {
my ($r)=@_;
+ &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
+ text=>"Parameter Change Log"});
$r->print(&Apache::loncommon::start_page('Parameter Change Log'));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log'));
@@ -4143,17 +4484,16 @@ sub handler {
&reset_caches();
- if ($r->header_only) {
- &Apache::loncommon::content_type($r,'text/html');
- $r->send_http_header;
- return OK;
- }
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+ return OK if $r->header_only;
+
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['action','state',
'pres_marker',
'pres_value',
'pres_type',
- 'udom','uname','symb','serial']);
+ 'udom','uname','symb','serial','timebase']);
&Apache::lonhtmlcommon::clear_breadcrumbs();
@@ -4171,12 +4511,6 @@ sub handler {
my $exists = &check_for_course_info();
if ($env{'request.course.id'} && $parm_permission && $exists) {
-
- # Start Page
- &Apache::loncommon::content_type($r,'text/html');
- $r->send_http_header;
-
-
#
# Main switch on form.action and form.state, as appropriate
#
@@ -4184,56 +4518,36 @@ sub handler {
# the table mode
if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
&& (!$env{'form.dis'})) || ($env{'form.symb'})) {
- &Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters',
- text=>"Problem Parameters"});
&assessparms($r);
-
} elsif (! exists($env{'form.action'})) {
- $r->print(&header());
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager'));
&print_main_menu($r,$parm_permission);
- } elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv',
- text=>"Course Environment"});
+ } elsif ($env{'form.action'} eq 'crsenv') {
&crsenv($r);
- } elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
- text=>"Overview Mode"});
+ } elsif ($env{'form.action'} eq 'setoverview') {
&overview($r);
- } elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',
- text=>"Add Metadata Field"});
+ } elsif ($env{'form.action'} eq 'addmetadata') {
&addmetafield($r);
- } elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata',
- text=>"Add Metadata Field"});
+ } elsif ($env{'form.action'} eq 'ordermetadata') {
&order_meta_fields($r);
- } elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta',
- text=>"Restrict Metadata"});
+ } elsif ($env{'form.action'} eq 'setrestrictmeta') {
&setrestrictmeta($r);
- } elsif ($env{'form.action'} eq 'newoverview' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview',
- text=>"Overview Mode"});
+ } elsif ($env{'form.action'} eq 'newoverview') {
&newoverview($r);
- } elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',
- text=>"Set Defaults"});
+ } elsif ($env{'form.action'} eq 'setdefaults') {
&defaultsetter($r);
- } elsif ($env{'form.action'} eq 'settable' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
- text=>"Table Mode",
- help => 'Course_Setting_Parameters'});
+ } elsif ($env{'form.action'} eq 'settable') {
&assessparms($r);
- } elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
- text=>"Parameter Change Log"});
+ } elsif ($env{'form.action'} eq 'parameterchangelog') {
&parm_change_log($r);
- } elsif ($env{'form.action'} eq 'cleanparameters' && $parm_permission) {
- &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters',
- text=>"Clean Parameters"});
+ } elsif ($env{'form.action'} eq 'cleanparameters') {
&clean_parameters($r);
- }
+ } elsif ($env{'form.action'} eq 'dateshift1') {
+ &date_shift_one($r);
+ } elsif ($env{'form.action'} eq 'dateshift2') {
+ &date_shift_two($r);
+ } elsif ($env{'form.action'} eq 'categorizecourse') {
+ &assign_course_categories($r);
+ }
} else {
# ----------------------------- Not in a course, or not allowed to modify parms
if ($exists) {