--- loncom/interface/lonparmset.pm 2015/08/16 20:45:41 1.552 +++ 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.552 2015/08/16 20:45:41 raeburn Exp $ +# $Id: lonparmset.pm,v 1.555 2016/01/31 21:25:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -777,7 +777,7 @@ 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') { @@ -791,7 +791,8 @@ sub valout { } } 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--; @@ -824,6 +825,9 @@ 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); @@ -850,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) { @@ -1138,10 +1142,11 @@ 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}, @@ -1177,14 +1182,14 @@ 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,$which,\@typeoutpar,$display); } elsif ($cgroup) { - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); } elsif ($csec) { &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); } else { @@ -1195,7 +1200,7 @@ sub print_row { if ($uname) { &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); } elsif ($cgroup) { - &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); + &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp); } elsif ($csec) { &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); } else { @@ -1232,9 +1237,9 @@ sub print_row { } if ($cgroup) { - &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display); - &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$which,\@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) { @@ -1255,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(''); @@ -1263,7 +1268,7 @@ 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; @@ -1271,6 +1276,10 @@ sub print_td { $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; @@ -1281,7 +1290,7 @@ sub print_td { } } 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], @@ -1306,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; @@ -1756,7 +1765,7 @@ sub partmenu { } sub usermenu { - my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups)=@_; + my ($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,$usersgroups,$pssymb)=@_; my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. &Apache::loncommon::selectstudent_link('parmform','uname','udom'); my $selscript=&Apache::loncommon::studentbrowser_javascript(); @@ -1765,7 +1774,12 @@ sub usermenu { my %sectionhash = &Apache::loncommon::get_sections(); my $groups; - my %grouphash = &Apache::longroup::coursegroups(); + my %grouphash; + if (($pssymb) || &Apache::lonnet::allowed('mdg',$env{'request.course.id'})) { + %grouphash = &Apache::longroup::coursegroups(); + } elsif ($env{'request.course.groups'} ne '') { + map { $grouphash{$_} = 1; } split(/,/,$env{'request.course.groups'}); + } my $g_s_header=''; my $g_s_footer=''; @@ -1809,7 +1823,7 @@ function group_or_section(caller) { // ]]> |; - } elsif ($currsec eq '') { + } else { $sections .= qq|