--- loncom/interface/lonparmset.pm 2009/12/03 17:50:42 1.488 +++ loncom/interface/lonparmset.pm 2013/12/13 23:39:51 1.522.2.11 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.488 2009/12/03 17:50:42 bisitz Exp $ +# $Id: lonparmset.pm,v 1.522.2.11 2013/12/13 23:39:51 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 -Input: See list below: +=over 4 -=item * B : An array that will contain all of the ids in the course. +=item * B : Current username -=item * B : hash, id->type, where "type" contains the extension of the file, thus, I. +=item * B : Domain of current user. -=item * B : hash, id->key list, will contain a comma separated list of the meta-data keys available for the given id +=item * B : hash, name of parameter->display value (what is the display value?) +Outputs: See list below -=item * B : hash, part identification->text representation of part, where the text representation is "[Part $part]" +=over 4 -=item * B : hash, full key to part->display value (what's display value?) +=item * B (out) : An array that will contain all of the ids in the course. -=item * B : hash, ??? +=item * B(out) : hash, id->type, where "type" contains the extension of the file, thus, I. -=item * B : ??? +=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 (out) : hash, part identification->text representation of part, where the text representation is "[Part $part]" + +=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,6 +319,7 @@ use Apache::lonlocal; use Apache::lonnavmaps; use Apache::longroup; use Apache::lonrss; +use HTML::Entities; use LONCAPA qw(:DEFAULT :match); @@ -662,7 +649,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 { @@ -769,11 +756,14 @@ sub valout { my $result = ''; # Values of zero are valid. if (! $value && $value ne '0') { - if ($editable) { - $result = '*'; - } else { - $result=' '; - } + if ($editable) { + $result = + ''.&mt('Change').''; + } else { + $result=' '; + } } else { if ($type eq 'date_interval') { my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); @@ -814,6 +804,7 @@ sub valout { &date_sanity_info($value); } else { $result = $value; + $result=~s/\,/\, /gs; $result = &HTML::Entities::encode($result,'"<>&'); } } @@ -855,16 +846,10 @@ sub page_js { return(< // "pclose()", - 'onload' => "showHide_courseContent(); group_or_section('cgroup')", - ); + 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'})) { @@ -915,20 +924,30 @@ 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(), + &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); $r->print(< + + ENDHEAD } @@ -961,7 +980,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; } @@ -1072,6 +1091,10 @@ sub print_td { if ($which > 3) { $nolink = 1; } + } elsif ($mprefix =~ /examcode\&$/) { + unless ($which == 2) { + $nolink = 1; + } } if ($nolink) { $r->print(&valout($$outpar[$which],$$typeoutpar[$which])); @@ -1169,6 +1192,7 @@ sub extractResourceInformation { $$typep{$id}=$1; $$keyp{$id}=''; $$uris{$id}=$srcf; + foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { next if ($key!~/^parameter_/); @@ -1224,7 +1248,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}); } @@ -1245,8 +1269,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)=@_; @@ -1267,14 +1292,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 { @@ -1396,10 +1382,13 @@ sub lookUpTableParameter { 'contentopen' => 'time_settings', 'contentclose' => 'time_settings', 'discussend' => 'time_settings', + 'printopendate' => 'time_settings', + 'printclosedate' => 'time_settings', 'weight' => 'grading', 'handgrade' => 'grading', 'maxtries' => 'tries', 'hinttries' => 'tries', + 'randomizeontries' => 'tries', 'type' => 'problem_appearance', 'problemstatus' => 'problem_appearance', 'display' => 'problem_appearance', @@ -1426,7 +1415,10 @@ sub lookUpTableParameter { 'acc' => 'misc', 'maxcollaborators' => 'misc', 'scoreformat' => 'misc', - + 'lenient' => 'grading', + 'retrypartial' => 'tries', + 'discussvote' => 'misc', + 'examcode' => 'high_level_randomization', ); } @@ -1493,47 +1485,36 @@ sub parmboxes { 'slots' => [], 'file_submission' => [], 'misc' => [], - ); + ); + foreach $tempparameter (keys %$allparms) { &whatIsMyCategory($tempparameter, \%categoryList); } #part to print the parm-list - $r->print(''); + $r->print("\n"); } # # This function offers some links on the parameter section to get with one click a group a parameters @@ -1541,51 +1522,43 @@ sub parmboxes { sub shortCuts { my ($r,$allparms,$pscat,$keyorder)=@_; - #part to print out the shortcuts for parmselection - $r->print('' - .'' - .'' - .'
' - .'
'.&mt('Parameter Selection').'' - .'' - .'• '.&mt('Select All').'' - .'' - .'
' - .'' - .'• '.&mt('Select Common Only').'' - .'' - .'
' - .'' - .'• '.&mt('Unselect All').'' - .'' - .'
' - .'
' - .'
'.&mt('Add Selection for...').'' - .'' - .'• '.&mt('Problem Dates').'' - .'' - .'' - .' • '.&mt('Content Dates').'' - .'' -# .'
' - .'' - .' • '.&mt('Discussion Settings').'' - .'' - .'' - .' • '.&mt('Visibilities').'' - .'' -# .'
' - .'' - .' • '.&mt('Part Parameters').'' - .'' - .'
' - .'
'); + # Parameter Selection + $r->print( + &Apache::lonhtmlcommon::start_funclist(&mt('Parameter Selection')) + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Select All').'') + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Select Common Only').'') + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Unselect All').'') + .&Apache::lonhtmlcommon::end_funclist() + ); + + # Add Selection for... + $r->print( + &Apache::lonhtmlcommon::start_funclist(&mt('Add Selection for...')) + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Problem Dates').'') + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Content Dates').'') + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Discussion Settings').'') + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Visibilities').'') + .&Apache::lonhtmlcommon::add_item_funclist( + ''.&mt('Part Parameters').'') + .&Apache::lonhtmlcommon::end_funclist() + ); } sub partmenu { my ($r,$allparts,$psprt)=@_; + my $selsize = 1+scalar(keys(%{$allparts})); + if ($selsize > 8) { + $selsize = 8; + } - $r->print(''); $r->print(''); @@ -1706,26 +1679,29 @@ function group_or_section(caller) { # This function shows on table Mode the available Parameters for the selected Resources # sub displaymenu { - my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; + my ($r,$allparms,$pscat,$psprt,$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); - $r->print(&Apache::lonhtmlcommon::end_pick_box()); + $r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); &parmboxes($r,$allparms,$pscat,$keyorder); - $r->print(&Apache::lonhtmlcommon::start_pick_box()); - $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); - &partmenu($r,$allparts,$psprt); + $r->print(&Apache::loncommon::end_scrollbox()); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); + } sub mapmenu { - my ($r,$allmaps,$pschp,$maptitles, $symbp)=@_; + my ($r,$allmaps,$pschp,$maptitles,$symbp)=@_; my %allmaps_inverted = reverse %$allmaps; my $navmap = Apache::lonnavmaps::navmap->new(); my $tree=[]; my $treeinfo={}; if (defined($navmap)) { - my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); + my $it=$navmap->getIterator(undef,undef,undef,1,1,undef); my $curRes; my $depth = 0; my %parent = (); @@ -1770,35 +1746,58 @@ sub mapmenu { $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'),'','',' id="mapmenu"')); if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) { my $icon = ''; - $r->print(&Apache::loncommon::start_data_table() - .&Apache::loncommon::start_data_table_row() - .''.$icon - .'' - .&Apache::loncommon::end_data_table_row() + my $whitespace = + ''; + + # Info about selectable folders/maps + $r->print( + '
' + .&mt('You can only select maps and folders which have modifiable settings.') + .' '.&Apache::loncommon::help_open_topic('Parameter_Set_Folder') + .'
' + ); + + $r->print(&Apache::loncommon::start_scrollbox('700px','680px','400px','mapmenuscroll')); + $r->print(&Apache::loncommon::start_data_table(undef,'mapmenuinner')); + + # Display row: "All Maps or Folders" + $r->print( + &Apache::loncommon::start_data_table_row(undef,'picklevel') + .'' + .'' + .'
' + .&Apache::loncommon::end_data_table_row() + ); + + # Display row: "Main Content" if (exists($$allmaps{1})) { - $r->print(&Apache::loncommon::start_data_table_row() - .''.$icon - .'' + .'' + .&Apache::loncommon::end_data_table_row() ); } + + # Display rows for all course maps and folders foreach my $id (@{$tree}) { my ($mapid,$resid)=split(/\./,$id); # Indentation @@ -1814,23 +1813,35 @@ sub mapmenu { my $symb_name = $$symbp{$id}; my ($front, $tail) = split (/___${resid}___/, $symb_name); $symb_name = $tail; - $r->print(&Apache::loncommon::start_data_table_row() - .''.$indent.$icon - .'' + .'' + .&Apache::loncommon::end_data_table_row() ); } - $r->print(&Apache::loncommon::end_data_table()); + + $r->print(&Apache::loncommon::end_data_table(). + '
'. + &Apache::loncommon::end_scrollbox()); } } @@ -1956,8 +1967,11 @@ sub standardkeyorder { 'parameter_0_tol' => 16, 'parameter_0_sig' => 17, 'parameter_0_turnoffunit' => 18, - 'parameter_0_discussend' => 19, - 'parameter_0_discusshide' => 20); + 'parameter_0_discussend' => 19, + 'parameter_0_discusshide' => 20, + 'parameter_0_discussvote' => 21, + 'parameter_0_printopendate' => 22, + 'parameter_0_printclosedate' => 23); } @@ -1965,6 +1979,9 @@ sub assessparms { my $r=shift; + + +# -------------------------------------------------------- Variable declaration my @ids=(); my %symbp=(); my %mapp=(); @@ -1972,9 +1989,6 @@ sub assessparms { my %keyp=(); my %uris=(); my %maptitles=(); - -# -------------------------------------------------------- Variable declaration - my %allmaps=(); my %alllevs=(); @@ -1993,14 +2007,16 @@ sub assessparms { my %allparms; my %allparts; +# ------------------------------------------------------------------------------ + # # Order in which these parameters will be displayed # my %keyorder=&standardkeyorder(); - @ids=(); - %symbp=(); - %typep=(); +# @ids=(); +# %symbp=(); # These seem defined above already. +# %typep=(); my $message=''; @@ -2017,8 +2033,11 @@ sub assessparms { my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); my $pschp=$env{'form.pschp'}; + + my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); if (!@psprt) { $psprt[0]='0'; } + if (($env{'form.part'}) && ($psprt[0] ne 'all')) { $psprt[0]=$env{'form.part'}; } my $pssymb=''; my $parmlev=''; @@ -2086,7 +2105,7 @@ sub assessparms { $message="\n

\n".&mt("Full Name").": ". $name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}. - "
\n".&mt('ID').": ".$name{'id'}.'

'; + "
\n".&mt('Student/Employee ID').": ".$name{'id'}.'

'; } @usersgroups = &Apache::lonnet::get_users_groups( $udom,$uname,$env{'request.course.id'}); @@ -2114,10 +2133,16 @@ sub assessparms { my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); my @values=split(/\&\&\&/,$env{'form.pres_value'}); my @types=split(/\&\&\&/,$env{'form.pres_type'}); + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $chome = $env{'course.'.$env{'request.course.id'}.'.home'}; + my ($got_chostname,$chostname,$cmajor,$cminor); + my $totalstored = 0; + + for (my $i=0;$i<=$#markers;$i++) { + my ($needsrelease,$needsnewer,$name); if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) { - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; my (@ok_slots,@fail_slots,@del_slots); my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); my ($level,@all) = @@ -2147,25 +2172,53 @@ sub assessparms { } } } + } elsif ($markers[$i] =~ /_(type|lenient|retrypartial|discussvote|examcode)\&\d+$/) { + $name = $1; + my $val = $values[$i]; + if ($name eq 'examcode') { + if (&Apache::lonnet::validCODE($values[$i])) { + $val = 'valid'; + } + } + $needsrelease = + $Apache::lonnet::needsrelease{"parameter:$name:$val"}; + if ($needsrelease) { + unless ($got_chostname) { + ($chostname,$cmajor,$cminor) = ¶meter_release_vars(); + $got_chostname = 1; + } + $needsnewer = ¶meter_releasecheck($name,$val, + $needsrelease, + $chostname, + $cmajor,$cminor); + } + } + if ($needsnewer) { + $message .= &oldversion_warning($name,$values[$i],$chostname,$cmajor, + $cminor,$needsrelease); + } else { + $message.=&storeparm(split(/\&/,$markers[$i]), + $values[$i], + $types[$i], + $uname,$udom,$csec,$cgroup); + $totalstored ++; } - $message.=&storeparm(split(/\&/,$markers[$i]), - $values[$i], - $types[$i], - $uname,$udom,$csec,$cgroup); } # ---------------------------------------------------------------- Done storing - $message.='

' - .&mt('Changes can take up to 10 minutes before being active for all students.') - .&Apache::loncommon::help_open_topic('Caching') - .'

'; + if ($totalstored) { + $message.='

' + .&mt('Changes can take up to 10 minutes before being active for all students.') + .&Apache::loncommon::help_open_topic('Caching') + .'

'; + } } #----------------------------------------------- if all selected, fill in array if ($pscat[0] eq "all") {@pscat = (keys %allparms);} - if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries') }; + if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') }; if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);} # ------------------------------------------------------------------ Start page - &startpage($r); + &startpage($r,$pssymb); foreach ('tolerance','date_default','date_start','date_end', 'date_interval','int','float','string') { @@ -2188,7 +2241,6 @@ function parmsel_show() { ENDPARMSELSCRIPT - # Display Unit 1 "General Parameters" if (!$pssymb) { my $parmselhiddenstyle=' style="display:none"'; if($env{'form.hideparmsel'} eq 'hidden') { @@ -2197,48 +2249,44 @@ ENDPARMSELSCRIPT $r->print('
'); } - $r->print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification'))); - $r->print(<print(&Apache::lonhtmlcommon::topic_bar(1,&mt('Resource Specification'),'parmstep1')); + $r->print(' -COURSECONTENTSCRIPT - - $r->print(&Apache::lonhtmlcommon::start_pick_box()); +'); + $r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); &levelmenu($r,\%alllevs,$parmlev); - $r->print(&Apache::lonhtmlcommon::row_closure(1)); - $r->print(&Apache::lonhtmlcommon::end_pick_box()); - $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::lonhtmlcommon::row_closure()); &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); + $r->print(&Apache::lonhtmlcommon::row_closure()); + $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); + &partmenu($r,\%allparts,\@psprt); $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); - #Display Unit 2 "Select Parameter" - $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'))); - &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); - $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'))); + + # Step 2 + $r->print(&Apache::lonhtmlcommon::topic_bar(2,&mt('Parameter Specification'),'parmstep2')); + &displaymenu($r,\%allparms,\@pscat,\@psprt,\%keyorder,'parmmenuscroll'); + + # Step 3 + $r->print(&Apache::lonhtmlcommon::topic_bar(3,&mt('User Specification (optional)'),'parmstep3')); $r->print(&Apache::lonhtmlcommon::start_pick_box()); &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); + + # Update Display Button $r->print('

' .'' + .' value="'.&mt('Update Display').'" />' .'' .'

'); $r->print('
'); + # Offer link to display parameter selection again $r->print(''); } else { + $r->print(); # parameter screen for a single resource. my ($map,$iid,$resource)=&Apache::lonnet::decode_symb($pssymb); my $title = &Apache::lonnet::gettitle($pssymb); - $r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). + $r->print(&mt('Specific Resource: [_1] ([_2])', + $title,''.$resource.''). ''. '
'); $r->print(&Apache::lonhtmlcommon::topic_bar('',&mt('Additional Display Specification (optional)'))); $r->print(&Apache::lonhtmlcommon::start_pick_box()); $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')). - ''); + ''); &usermenu($r,$uname,$id,$udom,$csec,$cgroup,$parmlev,\@usersgroups); $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); $r->print('

' .'' + .' value="'.&mt('Update Display').'" />' .'' .'

'); } @@ -2292,13 +2345,19 @@ COURSECONTENTSCRIPT my $csudom=$env{'user.domain'}; if ($parmlev eq 'full') { +# +# This produces the cascading table output of parameters +# my $coursespan=$csec?8:5; my $userspan=3; if ($cgroup ne '') { $coursespan += 3; } - $r->print('

'); + $r->print(&Apache::loncommon::start_data_table()); +# +# This produces the headers +# $r->print(''); $r->print(''); if ($uname) { @@ -2311,7 +2370,6 @@ COURSECONTENTSCRIPT my %lt=&Apache::lonlocal::texthash( 'pie' => "Parameter in Effect", 'csv' => "Current Session Value", - 'at' => 'at', 'rl' => "Resource Level", 'ic' => 'in Course', 'aut' => "Assessment URL and Title", @@ -2327,7 +2385,7 @@ COURSECONTENTSCRIPT ); $r->print(<$lt{'pie'} - + @@ -2363,7 +2421,9 @@ ENDTABLEHEADFOUR } $r->print(''); - +# +# Done with the headers +# my $defbgone=''; my $defbgtwo=''; my $defbgthree = ''; @@ -2403,11 +2463,18 @@ ENDTABLEHEADFOUR my %default=(); my $uri=&Apache::lonnet::declutter($uris{$rid}); + my $filter=$env{'form.filter'}; foreach (&keysplit($keyp{$rid})) { my $tempkeyp = $_; if (grep $_ eq $tempkeyp, @catmarker) { + my $parmname=&Apache::lonnet::metadata($uri,$_.'.name'); +# We may only want certain parameters listed + if ($filter) { + unless ($filter=~/\Q$parmname\E/) { next; } + } + $name{$_}=$parmname; $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); - $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); + my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display'); if ($allparms{$name{$_}} ne '') { my $identifier; @@ -2451,8 +2518,8 @@ ENDTABLEHEADFOUR $r->print(''); - foreach (&keysinorder_bytype(\%name,\%keyorder)) { + unless ($firstrow) { $r->print(''); } else { @@ -2467,7 +2534,7 @@ ENDTABLEHEADFOUR } } # end foreach ids # -------------------------------------------------- End entry for one resource - $r->print('
'.&mt('Any User').'$lt{'csv'}
($csuname $lt{'at'} $csudom)
$lt{'csv'}
($csuname:$csudom)
$lt{'ic'}$lt{'rl'} $lt{'ic'}
'.$maptitles{$mapp{$rid}}.'
'); + $r->print(&Apache::loncommon::end_data_table); } # end of full #--------------------------------------------------- Entry for parm level map if ($parmlev eq 'map') { @@ -2683,7 +2750,8 @@ ENDMAPONE ); } # end of $parmlev eq general } - $r->print(''.&Apache::loncommon::end_page()); + $r->print(''); + $r->print(&Apache::loncommon::end_page()); } # end sub assessparms ################################################## @@ -2745,8 +2813,9 @@ sub storedata { undef %newdata; my @deldata=(); undef @deldata; - foreach (keys %env) { - if ($_=~/^form\.([a-z]+)\_(.+)$/) { + my ($got_chostname,$chostname,$cmajor,$cminor); + foreach my $key (keys(%env)) { + if ($key =~ /^form\.([a-z]+)\_(.+)$/) { my $cmd=$1; my $thiskey=$2; my ($tuname,$tudom)=&extractuser($thiskey); @@ -2755,13 +2824,46 @@ sub storedata { $tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./; } if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') { - my ($data, $typeof, $text); + my ($data, $typeof, $text, $name); if ($cmd eq 'set') { - $data=$env{$_}; + $data=$env{$key}; $typeof=$env{'form.typeof_'.$thiskey}; $text = &mt('Saved modified parameter for'); + if ($typeof eq 'string_questiontype') { + $name = 'type'; + } elsif ($typeof eq 'string_lenient') { + $name = 'lenient'; + } elsif ($typeof eq 'string_discussvote') { + $name = 'discussvote'; + } elsif ($typeof eq 'string_examcode') { + $name = 'examcode'; + } elsif ($typeof eq 'string_yesno') { + if ($thiskey =~ /\.retrypartial$/) { + $name = 'retrypartial'; + } + } + if ($name ne '') { + my ($needsrelease,$needsnewer); + $needsrelease = $Apache::lonnet::needsrelease{"parameter:$name:$data"}; + if ($needsrelease) { + unless ($got_chostname) { + ($chostname,$cmajor,$cminor)=¶meter_release_vars(); + $got_chostname = 1; + } + $needsnewer = ¶meter_releasecheck($name,$data, + $needsrelease, + $chostname,$cmajor, + $cminor); + } + if ($needsnewer) { + $r->print('
'.&oldversion_warning($name,$data, + $chostname,$cmajor, + $cminor,$needsrelease)); + next; + } + } } elsif ($cmd eq 'datepointer') { - $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); + $data=&Apache::lonhtmlcommon::get_date_from_form($env{$key}); $typeof=$env{'form.typeof_'.$thiskey}; $text = &mt('Saved modified date for'); } elsif ($cmd eq 'dateinterval') { @@ -2811,7 +2913,7 @@ sub storedata { if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { my %loghash=map { $_ => '' } @deldata; &log_parmset(\%loghash,1); - $r->print('

'.&mt('Deleted [_1] parameter(s)

',$delentries)); + $r->print('

'.&mt('Deleted [_1] parameter(s)',$delentries).'

'); } else { $r->print('
'. &mt('Error deleting parameters').'
'); @@ -2990,7 +3092,7 @@ sub listdata { $$resourcedata{$thiskey})); } elsif ($thistype =~ m/^string/) { $r->print(&string_selector($thistype,$thiskey, - $$resourcedata{$thiskey})); + $$resourcedata{$thiskey},$name)); } else { $r->print(&default_selector($thiskey,$$resourcedata{$thiskey})); } @@ -3016,7 +3118,7 @@ sub date_interval_selector { my %select = ((map {$_ => $_} (0..$max)), 'select_form_order' => [0..$max]); $result .= &Apache::loncommon::select_form($amount,$name.'_'.$thiskey, - %select); + \%select); $result .= ' '.&mt($name); } $result .= ''; @@ -3055,25 +3157,111 @@ my %strings = [ '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.' ]], + 'string_questiontype' + => [[ 'problem', 'Standard Problem'], + [ 'survey', 'Survey'], + [ 'anonsurveycred', 'Anonymous Survey (credit for submission)'], + [ 'exam', 'Exam'], + [ 'anonsurvey', 'Anonymous Survey'], + [ 'randomizetry', 'New Randomization Each N Tries (default N=1)'], + [ 'practice', 'Practice'], + [ 'surveycred', 'Survey (credit for submission)']], + 'string_lenient' + => [['yes', 'Yes' ], + [ 'no', 'No' ], + [ 'default', 'Default - only bubblesheet grading is lenient' ]], + 'string_discussvote' + => [['yes','Yes'], + ['notended','Yes, unless discussion ended'], + ['no','No']], ); +sub standard_string_options { + my ($string_type) = @_; + if (ref($strings{$string_type}) eq 'ARRAY') { + return $strings{$string_type}; + } + return; +} sub string_selector { - my ($thistype, $thiskey, $showval) = @_; + my ($thistype, $thiskey, $showval, $name) = @_; if (!exists($strings{$thistype})) { return &default_selector($thiskey,$showval); } + my %skiptype; + if (($thistype eq 'string_questiontype') || + ($thistype eq 'string_lenient') || + ($thistype eq 'string_discussvote') || + ($name eq 'retrypartial')) { + my ($got_chostname,$chostname,$cmajor,$cminor); + foreach my $possibilities (@{ $strings{$thistype} }) { + next unless (ref($possibilities) eq 'ARRAY'); + my ($parmval, $description) = @{ $possibilities }; + my $needsrelease=$Apache::lonnet::needsrelease{"parameter:$name:$parmval"}; + if ($needsrelease) { + unless ($got_chostname) { + ($chostname,$cmajor,$cminor)=¶meter_release_vars(); + $got_chostname = 1; + } + my $needsnewer=¶meter_releasecheck($name,$parmval,$needsrelease, + $chostname,$cmajor, + $cminor); + if ($needsnewer) { + $skiptype{$parmval} = 1; + } + } + } + } + + my $result; - foreach my $possibilities (@{ $strings{$thistype} }) { - my ($name, $description) = @{ $possibilities }; - $result .= ' '; + if ($result) { + $result = ''.$result.'
'; } return $result; } @@ -3120,11 +3308,24 @@ sub newoverview { 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 %loaditems = ( + 'onload' => "showHide_courseContent(); resize_scrollbox('mapmenuscroll','1','1');", + ); + my $js = ' + +'; + my $start_page = &Apache::loncommon::start_page('Set Parameters',$js, + {'add_entries' => \%loaditems,}); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); + $r->print($start_page.$breadcrumbs); $r->print(< ENDOVER my @ids=(); @@ -3150,6 +3351,7 @@ ENDOVER my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); my $pschp=$env{'form.pschp'}; + my @psprt=&Apache::loncommon::get_env_multiple('form.psprt'); if (!@psprt) { $psprt[0]='0'; } @@ -3185,7 +3387,7 @@ ENDOVER $r->print('
'); #$r->print('

Step 1

'); $r->print('
'); - $r->print(&Apache::lonhtmlcommon::start_pick_box()); + $r->print(&Apache::lonhtmlcommon::start_pick_box(undef,'parmlevel')); &levelmenu($r,\%alllevs,$parmlev); if ($parmlev ne 'general') { $r->print(&Apache::lonhtmlcommon::row_closure()); @@ -3197,10 +3399,7 @@ ENDOVER $r->print('
'); $r->print('
'); - $r->print(&Apache::lonhtmlcommon::start_pick_box()); - &parmmenu($r,\%allparms,\@pscat,\%keyorder); - $r->print(&Apache::lonhtmlcommon::end_pick_box()); - &parmboxes($r,\%allparms,\@pscat,\%keyorder); + &displaymenu($r,\%allparms,\@pscat,\%keyorder); $r->print(&Apache::lonhtmlcommon::start_pick_box()); $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View'))); $r->print(''. @@ -3250,7 +3449,8 @@ ENDOVER } $r->print(&tableend(). ((($env{'form.store'}) || ($env{'form.dis'}))?'

':''). - ''.&Apache::loncommon::end_page()); + ''); + $r->print(&Apache::loncommon::end_page()); } sub secgroup_lister { @@ -3297,11 +3497,9 @@ sub overview { text=>"Overview Mode"}); my $start_page=&Apache::loncommon::start_page('Modify Parameters'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); - $r->print(< -ENDOVER + $r->print($start_page.$breadcrumbs); + $r->print('
'); + # Store modified &storedata($r,$crs,$dom); @@ -3320,7 +3518,7 @@ ENDOVER my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); $r->print(&tableend().'

'. - ($foundkeys?'':&mt('There are no parameters.')).'

'. + ($foundkeys?'':''.&mt('There are no parameters.').'').'

'. &Apache::loncommon::end_page()); } @@ -3396,8 +3594,9 @@ ENDOVER } elsif ($data{'realm_type'} eq 'symb') { my ($map,$resid,$url) = &Apache::lonnet::decode_symb($data{'realm'}); - $r->print(&mt('Resource: [_1]
   with ID: [_2]
   in folder [_3]', - $url,$resid,$map)); + $r->print(&mt('Resource: [_1]with ID: [_2]in folder [_3]', + $url.'
   ', + $resid.'
   ',$map)); } $r->print('
   '.&mt('Part: [_1]',$data{'parameter_part'})); $r->print(''); @@ -3406,8 +3605,8 @@ ENDOVER } $r->print(&Apache::loncommon::end_data_table().'

'. ''. - '

'. - &Apache::loncommon::end_page()); + '

'); + $r->print(&Apache::loncommon::end_page()); } sub date_shift_one { @@ -3419,11 +3618,8 @@ sub date_shift_one { text=>"Shifting Dates"}); my $start_page=&Apache::loncommon::start_page('Shift Dates'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); - $r->print(<print('
'. + $r->print($start_page.$breadcrumbs); + $r->print(''. '
'. '
'.&mt('Currently set date:').''. &Apache::lonlocal::locallocaltime($env{'form.timebase'}).'
'.&mt('Shifted date:').''. @@ -3446,10 +3642,7 @@ sub date_shift_two { text=>"Shifting Dates"}); my $start_page=&Apache::loncommon::start_page('Shift Dates'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Shift'); - $r->print(<print($start_page.$breadcrumbs); my $timeshifted=&Apache::lonhtmlcommon::get_date_from_form('timeshifted'); $r->print(&mt('Shifting all dates such that [_1] becomes [_2]', &Apache::lonlocal::locallocaltime($env{'form.timebase'}), @@ -3499,125 +3692,8 @@ sub parse_key { } - -sub extract_cloners { - my ($clonelist,$allowclone) = @_; - if ($clonelist =~ /,/) { - @{$allowclone} = split(/,/,$clonelist); - } else { - $$allowclone[0] = $clonelist; - } -} - -sub check_cloners { - my ($clonelist,$oldcloner) = @_; - my ($clean_clonelist,%disallowed); - my @allowclone = (); - &extract_cloners($$clonelist,\@allowclone); - foreach my $currclone (@allowclone) { - if (!grep(/^\Q$currclone\E$/,@$oldcloner)) { - if ($currclone eq '*') { - $clean_clonelist .= $currclone.','; - } else { - my ($uname,$udom) = split(/:/,$currclone); - if ($uname eq '*') { - if ($udom =~ /^$match_domain$/) { - if (!&Apache::lonnet::domain($udom)) { - $disallowed{'domain'} .= $currclone.','; - } else { - $clean_clonelist .= $currclone.','; - } - } else { - $disallowed{'format'} .= $currclone.','; - } - } elsif ($currclone !~/^($match_username)\:($match_domain)$/) { - $disallowed{'format'} .= $currclone.','; - } else { - if (&Apache::lonnet::homeserver($uname,$udom) eq 'no_host') { - $disallowed{'newuser'} .= $currclone.','; - } else { - $clean_clonelist .= $currclone.','; - } - } - } - } else { - $clean_clonelist .= $currclone.','; - } - } - foreach my $key (keys(%disallowed)) { - $disallowed{$key} =~ s/,$//; - } - if ($clean_clonelist) { - $clean_clonelist =~ s/,$//; - } - $$clonelist = $clean_clonelist; - return %disallowed; -} - -sub change_clone { - my ($clonelist,$oldcloner) = @_; - my ($uname,$udom); - my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; - my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $clone_crs = $cnum.':'.$cdom; - - if ($cnum && $cdom) { - my @allowclone; - &extract_cloners($clonelist,\@allowclone); - foreach my $currclone (@allowclone) { - if (!grep(/^$currclone$/,@$oldcloner)) { - if ($currclone ne '*') { - ($uname,$udom) = split(/:/,$currclone); - if ($uname && $udom && $uname ne '*') { - if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { - my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); - if ($currclonecrs{'cloneable'} !~ /\Q$clone_crs\E/) { - if ($currclonecrs{'cloneable'} eq '') { - $currclonecrs{'cloneable'} = $clone_crs; - } else { - $currclonecrs{'cloneable'} .= ','.$clone_crs; - } - &Apache::lonnet::put('environment',\%currclonecrs,$udom,$uname); - } - } - } - } - } - } - foreach my $oldclone (@$oldcloner) { - if (!grep(/^\Q$oldclone\E$/,@allowclone)) { - if ($oldclone ne '*') { - ($uname,$udom) = split(/:/,$oldclone); - if ($uname && $udom && $uname ne '*' ) { - if (&Apache::lonnet::homeserver($uname,$udom) ne 'no_host') { - my %currclonecrs = &Apache::lonnet::dump('environment',$udom,$uname,'cloneable'); - my %newclonecrs = (); - if ($currclonecrs{'cloneable'} =~ /\Q$clone_crs\E/) { - if ($currclonecrs{'cloneable'} =~ /,/) { - my @currclonecrs = split/,/,$currclonecrs{'cloneable'}; - foreach my $crs (@currclonecrs) { - if ($crs ne $clone_crs) { - $newclonecrs{'cloneable'} .= $crs.','; - } - } - $newclonecrs{'cloneable'} =~ s/,$//; - } else { - $newclonecrs{'cloneable'} = ''; - } - &Apache::lonnet::put('environment',\%newclonecrs,$udom,$uname); - } - } - } - } - } - } - } -} - - - sub header { - return &Apache::loncommon::start_page('Parameter Manager'); + return &Apache::loncommon::start_page('Content and Problem Settings'); } @@ -3626,7 +3702,7 @@ sub print_main_menu { my ($r,$parm_permission)=@_; # $r->print(&header()); - $r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Content and Problem Settings')); $r->print(< @@ -3636,39 +3712,36 @@ ENDMAINFORMHEAD my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); my $mgr = &Apache::lonnet::allowed('mgr',$env{'request.course.id'}); + my $dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}); + if ((!$dcm) && ($env{'request.course.sec'} ne '')) { + $dcm = &Apache::lonnet::allowed('dcm',$env{'request.course.id'}. + '/'.$env{'request.course.sec'}); + } my $crstype = &Apache::loncommon::course_type(); my $lc_crstype = lc($crstype); my @menu = - ( { categorytitle=>"Settings for this $crstype", + ( { categorytitle=>"Content Settings for this $crstype", items => [ - { linktext => "$crstype Configuration", - url => '/adm/courseprefs?origin=params', - permission => $parm_permission, - linktitle => "Edit $lc_crstype configuration." , - icon => 'preferences-desktop-remote-desktop.png' , - #help => 'Course_Environment', - }, { linktext => 'Portfolio Metadata', url => '/adm/parmset?action=setrestrictmeta', permission => $parm_permission, linktitle => "Restrict metadata for this $lc_crstype." , icon =>'contact-new.png' , }, - { linktext => "Manage $crstype Slots", - url => '/adm/slotrequest?command=showslots', - permission => $vgr, - linktitle => "Manage slots for this $lc_crstype." , - icon => 'format-justify-fill.png' , - }, { linktext => 'Reset Student Access Times', url => '/adm/helper/resettimes.helper', permission => $mgr, linktitle => "Reset access times for folders/maps, resources or the $lc_crstype." , icon => 'start-here.png' , }, - + { linktext => 'Blocking Communication/Resource Access', + url => '/adm/setblock', + permission => $dcm, + linktitle => 'Configure blocking of communication/collaboration and access to resources during an exam', + icon => 'comblock.png', + }, { linktext => 'Set Parameter Setting Default Actions', url => '/adm/parmset?action=setdefaults', permission => $parm_permission, @@ -3715,6 +3788,7 @@ ENDMAINFORMHEAD }]} ); $r->print(&Apache::lonhtmlcommon::generate_menu(@menu)); + $r->print(''.&Apache::loncommon::end_page()); return; } @@ -3843,7 +3917,7 @@ sub order_meta_fields { foreach my $key (@fields_in_order) { $r->print('
'); $r->print('
'); - $r->print(''); for (my $i = 1;$i le $num_fields;$i ++) { if ($i eq $idx) { $r->print(''); @@ -4048,11 +4122,8 @@ sub defaultsetter { my $start_page = &Apache::loncommon::start_page('Parameter Setting Default Actions'); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); - $r->print(< -ENDDEFHEAD + $r->print($start_page.$breadcrumbs); + $r->print(''); my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; @@ -4197,8 +4268,8 @@ ENDYESNO } $r->print(&Apache::loncommon::end_data_table(). "\n".''."\n". - &Apache::loncommon::end_page()); + &mt('Save').'" />'."\n"); + $r->print(&Apache::loncommon::end_page()); return; } @@ -4288,16 +4359,22 @@ 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')); + 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'}); if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } - $r->print('
print('
'. + '
'.&mt('Display of Changes').''. + ''); my %saveable_parameters = ('show' => 'scalar',); @@ -4305,10 +4382,9 @@ sub parm_change_log { \%saveable_parameters); &Apache::loncommon::restore_course_settings('parameter_log', \%saveable_parameters); - $r->print(&Apache::loncommon::display_filter(). - ''. - ''); + $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'}); @@ -4505,10 +4581,10 @@ sub update_slots { action => 'reserve', context => 'parameter', ); - &Apache::lonnet::instructor_log('slotreservationslog',\%storehash, + &Apache::lonnet::write_log('course','slotreservationslog',\%storehash, '',$uname,$udom,$cnum,$cdom); - &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, + &Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, '',$uname,$udom,$uname,$udom); } return $success; @@ -4539,9 +4615,9 @@ sub delete_slots { action => 'release', context => 'parameter', ); - &Apache::lonnet::instructor_log('slotreservationslog',\%storehash, + &Apache::lonnet::write_log('course','slotreservationslog',\%storehash, 1,$uname,$udom,$cnum,$cdom); - &Apache::lonnet::instructor_log($cdom.'_'.$cnum.'_slotlog',\%storehash, + &Apache::lonnet::write_log('course',$cdom.'_'.$cnum.'_slotlog',\%storehash, 1,$uname,$udom,$uname,$udom); } } @@ -4555,6 +4631,61 @@ 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,$needsrelease,$chostname,$cmajor,$cminor) = @_; + my $needsnewer; + my ($needsmajor,$needsminor) = split(/\./,$needsrelease); + if (($cmajor < $needsmajor) || + ($cmajor == $needsmajor && $cminor < $needsminor)) { + $needsnewer = 1; + } else { + &Apache::lonnet::update_released_required($Apache::lonnet::needsrelease{'parameter:'.$name.':'.$value}); + } + return $needsnewer; +} + +sub oldversion_warning { + my ($name,$value,$chostname,$cmajor,$cminor,$needsrelease) = @_; + my $desc; + my %stringtypes = ( + type => 'string_questiontype', + lenient => 'string_lenient', + retrypartial => 'string_yesno', + discussvote => 'string_discussvote', + examcode => 'string_examcode', + ); + if (exists($stringtypes{$name})) { + if ($name eq 'examcode') { + $desc = $value; + } elsif (ref($strings{$stringtypes{$name}}) eq 'ARRAY') { + foreach my $possibilities (@{ $strings{$stringtypes{$name}} }) { + next unless (ref($possibilities) eq 'ARRAY'); + my ($parmval, $description) = @{ $possibilities }; + if ($parmval eq $value) { + $desc = $description; + last; + } + } + } + } + my $standard_name = &standard_parameter_names($name); + return '

'. + &mt('[_1] was [_2]not[_3] set to [_4].', + $standard_name,'','','"'.$desc.'"').'
'. + &mt('LON-CAPA version ([_1]) installed on home server ([_2]) does not meet version requirements ([_3] or newer).', + $cmajor.'.'.$cminor,$chostname, + $needsrelease). + '

'; +} sub handler { my $r=shift; @@ -4570,12 +4701,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 => @@ -4621,8 +4753,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