--- loncom/interface/lonparmset.pm 2011/01/15 21:49:37 1.510 +++ loncom/interface/lonparmset.pm 2014/02/26 03:34:01 1.522.2.13 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.510 2011/01/15 21:49:37 www Exp $ +# $Id: lonparmset.pm,v 1.522.2.13 2014/02/26 03:34:01 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 -Input: See list below: +=item * B : Current username -=item * B : An array that will contain all of the ids in the course. +=item * B : Domain of current user. + +=item * B : Course + +=back -=item * B : hash, id->type, where "type" contains the extension of the file, thus, I. +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() @@ -280,7 +298,6 @@ Set portfolio metadata Main handler. Calls &assessparms subroutine. - =back =cut @@ -306,27 +323,6 @@ use HTML::Entities; use LONCAPA qw(:DEFAULT :match); -sub startSettingsScreen { - my ($r,$mode)=@_; - - $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, @@ -653,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 { @@ -760,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); @@ -805,6 +804,7 @@ sub valout { &date_sanity_info($value); } else { $result = $value; + $result=~s/\,/\, /gs; $result = &HTML::Entities::encode($result,'"<>&'); } } @@ -846,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'})) { @@ -907,16 +924,22 @@ 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); - &startSettingsScreen($r,'parmset'); $r->print(< @@ -1068,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])); @@ -1165,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_/); @@ -1220,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}); } @@ -1288,8 +1316,9 @@ sub parmmenu { } function checkdisset() { - checkthis('discussend','pscat'); + checkthis('discussend','pscat'); checkthis('discusshide','pscat'); + checkthis('discussvote','pscat'); } function checkcontdates() { @@ -1353,6 +1382,8 @@ sub lookUpTableParameter { 'contentopen' => 'time_settings', 'contentclose' => 'time_settings', 'discussend' => 'time_settings', + 'printopendate' => 'time_settings', + 'printclosedate' => 'time_settings', 'weight' => 'grading', 'handgrade' => 'grading', 'maxtries' => 'tries', @@ -1384,7 +1415,10 @@ sub lookUpTableParameter { 'acc' => 'misc', 'maxcollaborators' => 'misc', 'scoreformat' => 'misc', - + 'lenient' => 'grading', + 'retrypartial' => 'tries', + 'discussvote' => 'misc', + 'examcode' => 'high_level_randomization', ); } @@ -1461,26 +1495,23 @@ sub parmboxes { #Print parameters for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) { - if(@{$categoryList{$key}} == 0) { - next; - } else { - $r->print('
' - .'

' - .&mt($categories{$key}) - .'

'."\n"); - foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { - $r->print('' - .'
'."\n"); + next if(@{$categoryList{$key}} == 0); + $r->print('
' + .'

' + .&mt($categories{$key}) + .'

'."\n"); + foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { + $r->print('' + .'
\n"); + $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} + : $tempkey) + .'
'."\n"); } + $r->print("
\n"); } $r->print("\n"); @@ -1522,8 +1553,12 @@ sub shortCuts { sub partmenu { my ($r,$allparts,$psprt)=@_; + my $selsize = 1+scalar(keys(%{$allparts})); + if ($selsize > 8) { + $selsize = 8; + } - $r->print(''); $r->print(''); @@ -1644,13 +1679,13 @@ function group_or_section(caller) { # This function shows on table Mode the available Parameters for the selected Resources # sub displaymenu { - my ($r,$allparms,$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::loncommon::start_scrollbox()); + $r->print(&Apache::loncommon::start_scrollbox('480px','440px','200px',$divid)); &parmboxes($r,$allparms,$pscat,$keyorder); $r->print(&Apache::loncommon::end_scrollbox()); @@ -1724,12 +1759,12 @@ sub mapmenu { .'' ); - $r->print(&Apache::loncommon::start_scrollbox()); - $r->print(&Apache::loncommon::start_data_table()); + $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() + &Apache::loncommon::start_data_table_row(undef,'picklevel') .'' .'