--- loncom/interface/lonparmset.pm 2009/11/08 19:51:22 1.480
+++ loncom/interface/lonparmset.pm 2016/01/31 21:25:38 1.555
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.480 2009/11/08 19:51:22 amueller Exp $
+# $Id: lonparmset.pm,v 1.555 2016/01/31 21:25:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -46,8 +46,6 @@ This module sets coursewide and assessme
=over
-=pod
-
=item parmval()
Figure out a cascading parameter.
@@ -137,33 +135,49 @@ javascript function 'pjump'.
=item extractResourceInformation() :
-Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
+ extractResourceInformation extracts lots of information about all of the the course's resources into a variety of hashes.
+
+Input: See list below
+
+=over 4
+
+=item * B : Current username
-Input: See list below:
+=item * B : Domain of current user.
-=item * B : An array that will contain all of the ids in the course.
+=item * B : Course
-=item * B : hash, id->type, where "type" contains the extension of the file, thus, I.
+=back
+
+Outputs: See list below:
-=item * B : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
+=over 4
-=item * B : hash, name of parameter->display value (what is the display value?)
+=item * B (out) : An array that will contain all of the ids in the course.
-=item * B : hash, part identification->text representation of part, where the text representation is "[Part $part]"
+=item * B(out) : hash, id->type, where "type" contains the extension of the file, thus, I.
-=item * B : hash, full key to part->display value (what's display value?)
+=item * B (out) : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id
-=item * B : hash, ???
+=item * B (out) : hash, name of parameter->display value (what is the display value?)
-=item * B : ???
+=item * B (out) : hash, part identification->text representation of part, where the text representation is "[Part $part]"
-=item * B : hash, ???
+=item * B (out) : hash, ???
=item * B : ??
=item * B : hash, id->full sym?
+=item * B
+
+=item * B
+=item * B
+
+=item * B
+
+=back
=item isdateparm()
@@ -196,12 +210,14 @@ Input: See list below:
Show assessment data and parameters. This is a large routine that should
be simplified and shortened... someday.
-Inputs: $r
-
+Inputs: $r - the Apache request object.
+
Returns: nothing
Variables used (guessed by Jeremy):
+=over
+
=item * B: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.
=item * B: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
@@ -214,6 +230,8 @@ Variables used (guessed by Jeremy):
When storing information, store as part 0
When requesting information, request from full part
+=back
+
=item tablestart()
=item tableend()
@@ -248,37 +266,6 @@ Variables used (guessed by Jeremy):
=item parse_key()
-=item check_cloners() :
-
-Checks if new users included in list of allowed cloners
-are valid users. Replaces supplied list with
-cleaned list containing only users with valid usernames
-and domains.
-
-Inputs: $clonelist, $oldcloner
-where $clonelist is ref to array of requested cloners,
-and $oldcloner is ref to array of currently allowed
-cloners.
-
-Returns: string - comma separated list of requested
-cloners (username:domain) who do not exist in system.
-
-=item change_clone() :
-
-Modifies the list of courses a user can clone (stored
-in the user's environment.db file), called when a
-change is made to the list of users allowed to clone
-a course.
-
-Inputs: $action,$cloner
-where $action is add or drop, and $cloner is identity of
-user for whom cloning ability is to be changed in course.
-
-
-=item check_cloners()
-
-=item change_clone()
-
=item header()
Output html header for page
@@ -311,7 +298,6 @@ Set portfolio metadata
Main handler. Calls &assessparms subroutine.
-
=back
=cut
@@ -333,9 +319,35 @@ use Apache::lonlocal;
use Apache::lonnavmaps;
use Apache::longroup;
use Apache::lonrss;
+use HTML::Entities;
use LONCAPA qw(:DEFAULT :match);
+sub startSettingsScreen {
+ my ($r,$mode,$crstype)=@_;
+
+ my $tabtext = &mt('Course Settings');
+ if ($crstype eq 'Community') {
+ $tabtext = &mt('Community Settings');
+ }
+ $r->print("\n".'');
+ $r->print("\n".' '.
+ $tabtext.
+ ' ');
+
+ $r->print("\n".''.
+ &mt('Content and Problem Settings').' ');
+ $r->print("\n".' '."\n");
+ $r->print('');
+}
+
+sub endSettingsScreen {
+ my ($r)=@_;
+ $r->print('
');
+}
+
+
+
sub parmval {
my ($what,$id,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_;
return &parmval_by_symb($what,&symbcache($id),$def,$uname,$udom,$csec,
@@ -662,7 +674,7 @@ sub storeparm_by_symb {
}
sub log_parmset {
- return &Apache::lonnet::instructor_log('parameterlog',@_);
+ return &Apache::lonnet::write_log('course','parameterlog',@_);
}
sub storeparm_by_symb_inner {
@@ -765,18 +777,22 @@ sub storeparm_by_symb_inner {
sub valout {
- my ($value,$type,$editable)=@_;
+ my ($value,$type,$name,$editable)=@_;
my $result = '';
# Values of zero are valid.
if (! $value && $value ne '0') {
- if ($editable) {
- $result = '* ';
- } else {
- $result=' ';
- }
+ if ($editable) {
+ $result =
+ ' ';
+ } else {
+ $result=' ';
+ }
} else {
if ($type eq 'date_interval') {
- my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
+ my ($totalsecs,$donebutton) = split(/_/,$value);
+ my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($totalsecs);
my @timer;
$year=$year-70;
$mday--;
@@ -809,11 +825,15 @@ sub valout {
push(@timer,&mt('[quant,_1,sec]',0));
}
$result.=join(", ",@timer);
+ if ($donebutton eq 'done') {
+ $result .= ' '.&mt('+ "done"');
+ }
} elsif (&isdateparm($type)) {
$result = &Apache::lonlocal::locallocaltime($value).
&date_sanity_info($value);
} else {
$result = $value;
+ $result=~s/\,/\, /gs;
$result = &HTML::Entities::encode($result,'"<>&');
}
}
@@ -834,7 +854,7 @@ sub plink {
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/);
my ($hour,$min,$sec,$val)=&preset_defaults($parmname);
unless (defined($winvalue)) { $winvalue=$val; }
- my $valout = &valout($value,$type,1);
+ my $valout = &valout($value,$type,$parmname,1);
my $unencmarker = $marker;
foreach my $item (\$type, \$dis, \$winvalue, \$marker, \$return, \$call,
\$hour, \$min, \$sec) {
@@ -855,16 +875,10 @@ sub page_js {
return(<
//
+
$selscript
ENDJS
}
+
+sub showhide_js {
+ return <<"COURSECONTENTSCRIPT";
+
+function showHide_courseContent() {
+ var parmlevValue=document.getElementById("parmlev").value;
+ if (parmlevValue == 'general') {
+ document.getElementById('mapmenu').style.display="none";
+ } else {
+ if ((parmlevValue == "full") || (parmlevValue == "map")) {
+ document.getElementById('mapmenu').style.display ="";
+ } else {
+ document.getElementById('mapmenu').style.display="none";
+ }
+ }
+ return;
+}
+
+COURSECONTENTSCRIPT
+}
+
+sub toggleparmtextbox_js {
+ return <<"ENDSCRIPT";
+
+if (!document.getElementsByClassName) {
+ function getElementsByClassName(node, classname) {
+ var a = [];
+ var re = new RegExp('(^| )'+classname+'( |$)');
+ var els = node.getElementsByTagName("*");
+ for(var i=0,j=els.length; i$remove ');
+ });
+
+ \$(wrapper).delegate(".LC_remove_ipacc","click", function(e){
+ e.preventDefault(); \$(this).closest("div").remove();
+ })
+});
+
+
+END
+}
+
sub startpage {
- my ($r) = @_;
+ my ($r,$psymb,$crstype) = @_;
- my %loaditems = ('onunload' => "pclose()",
- 'onload' => "group_or_section('cgroup')",
- 'onload' => "showHide_courseContent()",
- );
+ my %loaditems = (
+ 'onload' => "group_or_section('cgroup')",
+ );
+ if (!$psymb) {
+ $loaditems{'onload'} = "showHide_courseContent(); group_or_section('cgroup'); resize_scrollbox('mapmenuscroll','1','1');";
+ }
if ((($env{'form.command'} eq 'set') && ($env{'form.url'})
&& (!$env{'form.dis'})) || ($env{'form.symb'})) {
@@ -916,30 +1111,42 @@ sub startpage {
text=>"Table Mode",
help => 'Course_Setting_Parameters'});
}
+ my $js = &page_js().'
+
+';
my $start_page =
- &Apache::loncommon::start_page('Set/Modify Course Parameters',
- &page_js(),
- {'add_entries' => \%loaditems,});
+ &Apache::loncommon::start_page('Set/Modify Course Parameters',$js,
+ {'add_entries' => \%loaditems,});
my $breadcrumbs =
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode');
+ my $escfilter=&Apache::lonhtmlcommon::entity_encode($env{'form.filter'});
+ my $escpart=&Apache::lonhtmlcommon::entity_encode($env{'form.part'});
+ $r->print($start_page.$breadcrumbs);
+ &startSettingsScreen($r,'parmset',$crstype);
$r->print(<
+
+
ENDHEAD
}
sub print_row {
my ($r,$which,$part,$name,$symbp,$rid,$default,$defaulttype,$display,$defbgone,
- $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups)=@_;
+ $defbgtwo,$defbgthree,$parmlev,$uname,$udom,$csec,$cgroup,$usersgroups,$noeditgrp)=@_;
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
+
# get the values for the parameter in cascading order
# empty levels will remain empty
my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which},
@@ -962,7 +1169,7 @@ sub print_row {
if ($parmlev eq 'full') {
$r->print(''
- .$$part{$which}.' ');
+ .($$part{$which} eq '0'?'0 ('.&mt('default').')':$$part{$which}).'');
} else {
$parm=~s|\[.*\]\s||g;
}
@@ -975,30 +1182,29 @@ sub print_row {
my $thismarker=$which;
$thismarker=~s/^parameter\_//;
my $mprefix=$rid.'&'.$thismarker.'&';
- my $effective_parm = &valout($outpar[$result],$typeoutpar[$result]);
+ my $effective_parm = &valout($outpar[$result],$typeoutpar[$result],$thismarker);
my ($othergrp,$grp_parm,$controlgrp);
if ($parmlev eq 'general') {
-
if ($uname) {
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} elsif ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp);
} elsif ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} else {
- &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
}
} elsif ($parmlev eq 'map') {
if ($uname) {
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} elsif ($cgroup) {
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp);
} elsif ($csec) {
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} else {
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
}
} else {
if ($uname) {
@@ -1018,33 +1224,32 @@ sub print_row {
}
}
- &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
-
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
-
- if ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- }
+ &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+
+ if ($csec) {
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ }
if ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp);
+ &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp);
}
- if ($uname) {
+ if ($uname) {
if ($othergrp) {
$r->print($othergrp);
}
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- }
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ }
} # end of $parmlev if/else
$r->print(''.$effective_parm.' ');
@@ -1055,7 +1260,7 @@ sub print_row {
my $sessionvaltype=$typeoutpar[$result];
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
$r->print(''.
- &valout($sessionval,$sessionvaltype).' '.
+ &valout($sessionval,$sessionvaltype,$$name{$which}).' '.
' ');
}
$r->print('');
@@ -1063,19 +1268,29 @@ sub print_row {
}
sub print_td {
- my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_;
+ my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp)=@_;
$r->print('');
my $nolink = 0;
if ($which == 11 || $which == 12) {
$nolink = 1;
+ } elsif (($env{'request.course.sec'} ne '') && ($which > 9)) {
+ $nolink = 1;
+ } elsif ($which == 4 || $which == 5 || $which == 6) {
+ if ($noeditgrp) {
+ $nolink = 1;
+ }
} elsif ($mprefix =~ /availablestudent\&$/) {
if ($which > 3) {
$nolink = 1;
}
+ } elsif ($mprefix =~ /examcode\&$/) {
+ unless ($which == 2) {
+ $nolink = 1;
+ }
}
if ($nolink) {
- $r->print(&valout($$outpar[$which],$$typeoutpar[$which]));
+ $r->print(&valout($$outpar[$which],$$typeoutpar[$which],$mprefix));
} else {
$r->print(&plink($$typeoutpar[$which],
$$display{$value},$$outpar[$which],
@@ -1100,9 +1315,9 @@ sub print_usergroups {
if (($coursereply) && ($cgroup ne $resultgroup)) {
if ($result > 3) {
$bgcolor = '#AAFFAA';
- $grp_parm = &valout($coursereply,$resulttype);
+ $grp_parm = &valout($coursereply,$resulttype,$what);
}
- $grp_parm = &valout($coursereply,$resulttype);
+ $grp_parm = &valout($coursereply,$resulttype,$what);
$output = ' ';
if ($resultgroup && $resultlevel) {
$output .= ''.$resultgroup.' ('.$resultlevel.'): '.$grp_parm;
@@ -1170,6 +1385,7 @@ sub extractResourceInformation {
$$typep{$id}=$1;
$$keyp{$id}='';
$$uris{$id}=$srcf;
+
foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
next if ($key!~/^parameter_/);
@@ -1225,7 +1441,7 @@ sub extractResourceInformation {
$$mapp{$mapid}=$$mapp{$id};
$$allmaps{$mapid}=$$mapp{$id};
if ($mapid eq '1') {
- $$maptitles{$mapid}=&mt('Main Course Documents');
+ $$maptitles{$mapid}=&mt('Main Content');
} else {
$$maptitles{$mapid}=&Apache::lonnet::gettitle($$mapp{$id});
}
@@ -1246,8 +1462,9 @@ sub isdateparm {
}
#
-# This function prints a list of parameters, which were selected. It also display a link from which you can
-# hide or show the complete parameter list, from which you can choose your parameters.
+# parmmenu displays a list of the selected parameters.
+# It also offers a link to show/hide the complete parameter list
+# from which you can select all desired parameters.
#
sub parmmenu {
my ($r,$allparms,$pscat,$keyorder)=@_;
@@ -1268,14 +1485,12 @@ sub parmmenu {
ele = document.forms.parmform.elements[i];
if (ele.name == checkName) {
document.forms.parmform.elements[i].checked=value;
- document.getElementById(document.forms.parmform.elements[i].value.concat(li)).style.display = displayOverview;
}
}
}
function checkthis(thisvalue, checkName) {
- document.getElementById(thisvalue.concat("_li")).style.display = "";
for (i=0; i
ENDSCRIPT
- $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
-
- #part to print selected parms overview
- $r->print(&mt('Selected Parameters:').' ');
-
- #print out all possible parms and hide them by default
- $r->print('');
- foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
- $r->print('print(' style="display:none"');
- }
- $r->print('>'
- .($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey)
- .' '
- );
- }
- $r->print(' '
- .''
- .&mt('Show detailed Parameter Selection')
- .'
'
- );
+ $r->print(' ');
&shortCuts($r,$allparms,$pscat,$keyorder);
-
- $r->print(&Apache::lonhtmlcommon::row_closure(1));
+ $r->print(' ');
}
# return a hash
sub categories {
@@ -1397,10 +1575,13 @@ sub lookUpTableParameter {
'contentopen' => 'time_settings',
'contentclose' => 'time_settings',
'discussend' => 'time_settings',
+ 'printstartdate' => 'time_settings',
+ 'printenddate' => 'time_settings',
'weight' => 'grading',
'handgrade' => 'grading',
'maxtries' => 'tries',
'hinttries' => 'tries',
+ 'randomizeontries' => 'tries',
'type' => 'problem_appearance',
'problemstatus' => 'problem_appearance',
'display' => 'problem_appearance',
@@ -1427,7 +1608,10 @@ sub lookUpTableParameter {
'acc' => 'misc',
'maxcollaborators' => 'misc',
'scoreformat' => 'misc',
-
+ 'lenient' => 'grading',
+ 'retrypartial' => 'tries',
+ 'discussvote' => 'misc',
+ 'examcode' => 'high_level_randomization',
);
}
@@ -1479,9 +1663,7 @@ sub category_order {
sub parmboxes {
my ($r,$allparms,$pscat,$keyorder)=@_;
- my $tempkey;
- my $tempparameter;
- my %categories = &categories;
+ my %categories = &categories();
my %category_order = &category_order();
my %categoryList = (
'time_settings' => [],
@@ -1494,47 +1676,31 @@ sub parmboxes {
'slots' => [],
'file_submission' => [],
'misc' => [],
- );
- foreach $tempparameter (keys %$allparms) {
+ );
+
+ foreach my $tempparameter (keys(%$allparms)) {
&whatIsMyCategory($tempparameter, \%categoryList);
}
#part to print the parm-list
- $r->print(' ');
@@ -3410,24 +4338,24 @@ ENDOVER
}
$r->print(&Apache::loncommon::end_data_table().''.
' '.
- '
'.
- &Apache::loncommon::end_page());
+ '
');
+ &endSettingsScreen($r);
+ $r->print(&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'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
&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('');
+ &endSettingsScreen($r);
}
@@ -3939,6 +4764,8 @@ sub setrestrictmeta {
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata'));
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
+ &startSettingsScreen($r,'parmset',$crstype);
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'};
my $save_field = '';
if ($env{'form.restrictmeta'}) {
@@ -4009,6 +4836,7 @@ ENDButtons
$buttons
ENDenv
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
return 'ok';
}
@@ -4049,17 +4877,16 @@ sub defaultsetter {
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults',
text=>"Set Defaults"});
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'};
my $start_page =
- &Apache::loncommon::start_page('Parameter Setting Default Actions');
+ &Apache::loncommon::start_page('Parameter Setting Default Actions');
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults');
- $r->print(<
-ENDDEFHEAD
+ $r->print($start_page.$breadcrumbs);
+ &startSettingsScreen($r,'parmset',$crstype);
+ $r->print('');
- my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
- my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
my @ids=();
my %typep=();
my %keyp=();
@@ -4110,11 +4937,11 @@ ENDDEFHEAD
}
}
}
- foreach my $key (keys %allparms) {
+ foreach my $key (keys(%allparms)) {
$newrules{$key.'_triggers'}=$triggers{$key};
}
- &Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs);
- &Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs);
+ &Apache::lonnet::put('parmdefactions',\%newrules,$cdom,$cnum);
+ &Apache::lonnet::del('parmdefactions',\@delrules,$cdom,$cnum);
&resetrulescache();
}
my %lt=&Apache::lonlocal::texthash('days' => 'Days',
@@ -4201,8 +5028,9 @@ ENDYESNO
}
$r->print(&Apache::loncommon::end_data_table().
"\n".' '."\n".
- &Apache::loncommon::end_page());
+ &mt('Save').'" />'."\n");
+ &endSettingsScreen($r);
+ $r->print(&Apache::loncommon::end_page());
return;
}
@@ -4290,18 +5118,26 @@ sub standard_parameter_types {
sub parm_change_log {
my ($r)=@_;
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my $crstype = $env{'course.'.$env{'request.course.id'}.'.type'}
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
text=>"Parameter Change Log"});
- $r->print(&Apache::loncommon::start_page('Parameter Change Log'));
+ my $js = ''."\n";
+ $r->print(&Apache::loncommon::start_page('Parameter Change Log',$js));
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log'));
-
- my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',
- $env{'course.'.$env{'request.course.id'}.'.domain'},
- $env{'course.'.$env{'request.course.id'}.'.num'});
+ &startSettingsScreen($r,'parmset',$crstype);
+ my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',$cdom,$cnum);
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); }
- $r->print('print(''.
+ '
'.&mt('Display of Changes').' '.
+ '');
my %saveable_parameters = ('show' => 'scalar',);
@@ -4309,13 +5145,11 @@ sub parm_change_log {
\%saveable_parameters);
&Apache::loncommon::restore_course_settings('parameter_log',
\%saveable_parameters);
- $r->print(&Apache::loncommon::display_filter().
- ''.&Apache::lonhtmlcommon::checkbox('includetypes',$env{'form.includetypes'},'1').
- ' '.&mt('Include parameter types').' '.
- ' ');
+ $r->print(&Apache::loncommon::display_filter('parmslog').' '."\n".
+ ' '.
+ ' ');
- my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'},
- $env{'course.'.$env{'request.course.id'}.'.domain'});
+ my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom);
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().
''.&mt('Time').' '.&mt('User').' '.&mt('Extent').' '.&mt('Users').' '.
&mt('Parameter').' '.&mt('Part').' '.&mt('New Value').' '.&mt('Announce').' '.
@@ -4369,6 +5203,13 @@ sub parm_change_log {
!exists($parmlog{$id}{'logentry'}{$changed.'.type'}));
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)=
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag);
+ if ($env{'request.course.sec'} ne '') {
+ next if (($issection ne '') && ($issection ne $env{'request.course.sec'}));
+ if ($uname ne '') {
+ my $stusection = &Apache::lonnet::getsection($uname,$udom,$env{'request.course.id'});
+ next if (($stusection ne '-1') && ($stusection ne $env{'request.course.sec'}));
+ }
+ }
if ($env{'form.displayfilter'} eq 'currentfolder') {
if ($folder) {
if ($middle!~/^\Q$folder\E/) { next; }
@@ -4462,6 +5303,7 @@ sub parm_change_log {
|| $shown<=$env{'form.show'})) { last; }
}
$r->print(&Apache::loncommon::end_data_table());
+ &endSettingsScreen($r);
$r->print(&Apache::loncommon::end_page());
}
@@ -4509,11 +5351,11 @@ sub update_slots {
action => 'reserve',
context => 'parameter',
);
- &Apache::lonnet::instructor_log('slotreservationslog',\%storehash,
- '',$uname,$udom,$cnum,$cdom);
+ &Apache::lonnet::write_log('course','slotreservationslog',\%storehash,
+ '',$uname,$udom,$cnum,$cdom);
- &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash,
- '',$uname,$udom,$uname,$udom);
+ &Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash,
+ '',$uname,$udom,$uname,$udom);
}
return $success;
}
@@ -4543,10 +5385,10 @@ sub delete_slots {
action => 'release',
context => 'parameter',
);
- &Apache::lonnet::instructor_log('slotreservationslog',\%storehash,
- 1,$uname,$udom,$cnum,$cdom);
- &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash,
- 1,$uname,$udom,$uname,$udom);
+ &Apache::lonnet::write_log('course','slotreservationslog',\%storehash,
+ 1,$uname,$udom,$cnum,$cdom);
+ &Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash,
+ 1,$uname,$udom,$uname,$udom);
}
}
}
@@ -4559,6 +5401,29 @@ sub check_for_course_info {
return 0;
}
+sub parameter_release_vars {
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $chome = $env{'course.'.$env{'request.course.id'}.'.home'};
+ my $chostname = &Apache::lonnet::hostname($chome);
+ my ($cmajor,$cminor) =
+ split(/\./,&Apache::lonnet::get_server_loncaparev($cdom,$chome));
+ return ($chostname,$cmajor,$cminor);
+}
+
+sub parameter_releasecheck {
+ my ($name,$value,$valmatch,$needsrelease,$cmajor,$cminor) = @_;
+ my $needsnewer;
+ my ($needsmajor,$needsminor) = split(/\./,$needsrelease);
+ if (($cmajor < $needsmajor) ||
+ ($cmajor == $needsmajor && $cminor < $needsminor)) {
+ $needsnewer = 1;
+ } elsif ($valmatch) {
+ &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.'::'.$valmatch});
+ } elsif ($value) {
+ &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value.':'});
+ }
+ return $needsnewer;
+}
sub handler {
my $r=shift;
@@ -4574,12 +5439,13 @@ sub handler {
'pres_marker',
'pres_value',
'pres_type',
+ 'filter','part',
'udom','uname','symb','serial','timebase']);
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset",
- text=>"Parameter Manager",
+ text=>"Content and Problem Settings",
faq=>10,
bug=>'Instructor Interface',
help =>
@@ -4625,8 +5491,6 @@ sub handler {
&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