--- loncom/interface/lonparmset.pm 2017/07/13 15:29:56 1.578 +++ loncom/interface/lonparmset.pm 2017/07/15 04:58:17 1.581 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.578 2017/07/13 15:29:56 raeburn Exp $ +# $Id: lonparmset.pm,v 1.581 2017/07/15 04:58:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,7 +36,8 @@ lonparmset - Handler to set parameters f =head1 SYNOPSIS -lonparmset provides an interface to setting course parameters. +lonparmset provides an interface to setting content parameters in a +course. It contains all the code for the "Content and Problem Settings" UI, except for the helpers parameter.helper and resettimes.helper, and lonhelper.pm, @@ -137,7 +138,7 @@ javascript function 'pjump'. =item print_td() -=item print_usergroups() +=item check_other_groups() =item parm_control_group() @@ -1499,7 +1500,7 @@ sub print_row { if (@{$usersgroups} > 1) { my ($coursereply,$grp_parm,$controlgrp); ($coursereply,$othergrp,$grp_parm,$controlgrp) = - &print_usergroups($r,$$part{$which}.'.'.$$name{$which}, + &check_other_groups($$part{$which}.'.'.$$name{$which}, $rid,$cgroup,$defbgone,$usersgroups,$result,$courseopt); if ($coursereply && $result > 4) { if (defined($controlgrp)) { @@ -1638,11 +1639,9 @@ sub print_td { $r->print(''."\n"); } -# FIXME: Despite the name, this does not print anything, the $r parameter is unused. # Returns HTML and other info for the cell added when a user is selected # and that user is in several groups. This is the cell with the title "Control by other group". # -# @param {Apache2::RequestRec} $r - the Apache request (unused) # @param {string} $what - parameter part.'.'.parameter name # @param {string} $rid - resource id # @param {string} $cgroup - group name @@ -1651,8 +1650,8 @@ sub print_td { # @param {integer} $result - level # @param {hash reference} $courseopt - course parameters hash (result of lonnet::get_courseresdata, dump of course's resourcedata.db) # @returns {Array} - array (parameter value for the other group, HTML for the cell, HTML with the value, name of the other group) -sub print_usergroups { - my ($r,$what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; +sub check_other_groups { + my ($what,$rid,$cgroup,$defbg,$usersgroups,$result,$courseopt) = @_; my $courseid = $env{'request.course.id'}; my $output; my $symb = &symbcache($rid); @@ -1668,7 +1667,6 @@ sub print_usergroups { if (($coursereply) && ($cgroup ne $resultgroup)) { if ($result > 3) { $bgcolor = '#AAFFAA'; - $grp_parm = &valout($coursereply,$resulttype,$what); } $grp_parm = &valout($coursereply,$resulttype,$what); $output = ''; @@ -1685,7 +1683,7 @@ sub print_usergroups { } # Looks for a group with a defined parameter for given user and parameter. -# Used by print_usergroups. +# Used by check_other_groups. # # @param {string} $courseid - the course id # @param {array reference} $usersgroups - list of groups the user belongs to, if any @@ -1846,15 +1844,10 @@ sub isdateparm { } # Prints the HTML and Javascript to select parameters, with various shortcuts. -# FIXME: remove unused parameters # -# @param {Apache2::RequestRec} $r - the Apache request (unused) -# @param {hash reference} $allparms - hash parameter name -> parameter title -# @param {array reference} $pscat - list of selected parameter names (unused) -# @param {hash reference} $keyorder - hash parameter key -> appearance rank (unused) +# @param {Apache2::RequestRec} $r - the Apache request sub parmmenu { - my ($r,$allparms,$pscat,$keyorder)=@_; - my $tempkey; + my ($r)=@_; $r->print(< // print('
'); - &shortCuts($r,$allparms,$pscat,$keyorder); + &shortCuts($r); $r->print('
'); } @@ -2112,14 +2105,10 @@ sub parmboxes { } # Prints HTML with shortcuts to select groups of parameters in one click, or deselect all. -# FIXME: remove unused parameters # # @param {Apache2::RequestRec} $r - the Apache request -# @param {hash reference} $allparms - hash parameter name -> parameter title (unused) -# @param {array reference} $pscat - list of selected parameter names (unused) -# @param {hash reference} $keyorder - hash parameter key -> appearance rank (unused) sub shortCuts { - my ($r,$allparms,$pscat,$keyorder)=@_; + my ($r)=@_; # Parameter Selection $r->print( @@ -2312,16 +2301,15 @@ function group_or_section(caller) { # @param {Apache2::RequestRec} $r - the Apache request # @param {hash reference} $allparms - hash parameter name -> parameter title # @param {array reference} $pscat - list of selected parameter names -# @param {array reference} $psprt - list of selected parameter parts (unused) # @param {hash reference} $keyorder - hash parameter key -> appearance rank # @param {string} [$divid] - name used to give an id to the HTML element for the scroll box sub displaymenu { - my ($r,$allparms,$pscat,$psprt,$keyorder,$divid)=@_; + my ($r,$allparms,$pscat,$keyorder,$divid)=@_; $r->print(&Apache::lonhtmlcommon::start_pick_box()); $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); - &parmmenu($r,$allparms,$pscat,$keyorder); # only $allparms is used by parmmenu + &parmmenu($r); $r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); &parmboxes($r,$allparms,$pscat,$keyorder); $r->print(&Apache::loncommon::end_scrollbox()); @@ -3105,7 +3093,7 @@ ENDPARMSELSCRIPT # Step 2 $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); - &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll'); + &displaymenu($r,\%allparms,\@pscat,\%keyorder,'parmmenuscroll'); # Step 3 $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); @@ -5110,7 +5098,7 @@ ENDOVER $r->print('
'); $r->print('
'); - &displaymenu($r,\%allparms,\@pscat,\%keyorder); # FIXME: wrong parameters, could make keysindisplayorderCategory crash because $keyorder is undefined + &displaymenu($r,\%allparms,\@pscat,\%keyorder); $r->print(&Apache::lonhtmlcommon::start_pick_box()); $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); my $sectionselector = §ionmenu(\@selected_sections); @@ -5356,10 +5344,8 @@ ENDOVER $r->print(&mt('All users')); } elsif ($data{'scope_type'} eq 'user') { $r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); - } elsif ($data{'scope_type'} eq 'section') { - $r->print(&mt('Section: [_1]',$data{'scope'})); - } elsif ($data{'scope_type'} eq 'group') { - $r->print(&mt('Group: [_1]',$data{'scope'})); + } elsif ($data{'scope_type'} eq 'secgroup') { + $r->print(&mt('Group/Section: [_1]',$data{'scope'})); } $r->print('
'); if ($data{'realm_type'} eq 'all') { @@ -5466,8 +5452,7 @@ sub parse_key { $data{'scope_type'} = 'user'; $data{'scope'} = [$1,$2]; } else { - #FIXME check for group scope - $data{'scope_type'} = 'section'; + $data{'scope_type'} = 'secgroup'; } $middle=~s/^\[(.*)\]//; } @@ -5861,16 +5846,17 @@ sub addmetafield { $r->print('You may undelete previously deleted fields.
Check those you wish to undelete and click Undelete.
'); $r->print('
'); foreach my $key(keys(%$fields)) { - $r->print(''.$$fields{$key}.'
print('
print(''); $r->print('
'); } - $r->print('
Or you may enter a new metadata field name.
'); + $r->print('
Or you may enter a new metadata field name.'. + ''); $r->print('
'); $r->print(''); + $r->print('
'); } - $r->print(''); &endSettingsScreen($r); } @@ -6193,17 +6179,13 @@ ENDYESNO # $issection - section or group name # $realmdescription - title for the parameter level and resource (without using HTML) # -# FIXME: remove unused fields. -# # @param {string} $key - parameter log key # @param {string} $uname - user name # @param {string} $udom - user domain -# @param {string} $exeuser - unused -# @param {string} $exedomain - unused # @param {boolean} $typeflag - .type log entry # @returns {Array} sub components { - my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; + my ($key,$uname,$udom,$typeflag)=@_; if ($typeflag) { $key=~s/\.type$//; @@ -6418,7 +6400,7 @@ sub parm_change_log { my $typeflag = ($changed =~/\.type$/ && !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); + &components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},$typeflag); if ($env{'request.course.sec'} ne '') { next if (($issection ne '') && ($issection ne $env{'request.course.sec'})); if ($uname ne '') {