--- loncom/interface/lonparmset.pm 2011/05/18 11:26:44 1.512 +++ loncom/interface/lonparmset.pm 2013/07/10 22:07:37 1.536 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.512 2011/05/18 11:26:44 foxr Exp $ +# $Id: lonparmset.pm,v 1.536 2013/07/10 22:07:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -204,8 +204,8 @@ Outputs: 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): @@ -315,17 +315,21 @@ use LONCAPA qw(:DEFAULT :match); sub startSettingsScreen { - my ($r,$mode)=@_; + my ($r,$mode,$crstype)=@_; + my $tabtext = &mt('Course Settings'); + if ($crstype eq 'Community') { + $tabtext = &mt('Community Settings'); + } $r->print("\n".''."\n"); - $r->print('
'); + $r->print('
'); } sub endSettingsScreen { @@ -661,7 +665,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 { @@ -768,11 +772,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); @@ -813,6 +820,7 @@ sub valout { &date_sanity_info($value); } else { $result = $value; + $result=~s/\,/\, /gs; $result = &HTML::Entities::encode($result,'"<>&'); } } @@ -854,16 +862,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 startpage { - my ($r) = @_; + my ($r,$psymb,$crstype) = @_; - my %loaditems = ('onunload' => "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,16 +942,23 @@ 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'); + &startSettingsScreen($r,'parmset',$crstype); $r->print(< @@ -1076,6 +1110,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])); @@ -1173,8 +1211,6 @@ sub extractResourceInformation { $$typep{$id}=$1; $$keyp{$id}=''; $$uris{$id}=$srcf; - &Apache::lonnet::logthis("Invoking metadata $srcf"); - &Apache::lonnet::logthis(&Apache::lonnet::metadata($srcf, 'allpossiblekeys')); foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { next if ($key!~/^parameter_/); @@ -1231,7 +1267,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}); } @@ -1299,8 +1335,9 @@ sub parmmenu { } function checkdisset() { - checkthis('discussend','pscat'); + checkthis('discussend','pscat'); checkthis('discusshide','pscat'); + checkthis('discussvote','pscat'); } function checkcontdates() { @@ -1397,7 +1434,10 @@ sub lookUpTableParameter { 'acc' => 'misc', 'maxcollaborators' => 'misc', 'scoreformat' => 'misc', - + 'lenient' => 'grading', + 'retrypartial' => 'tries', + 'discussvote' => 'misc', + 'examcode' => 'high_level_randomization', ); } @@ -1470,33 +1510,25 @@ sub parmboxes { &whatIsMyCategory($tempparameter, \%categoryList); } #part to print the parm-list - $r->print('
'."\n"); - - #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"); + foreach my $key (sort { $category_order{$a} <=> $category_order{$b} } keys(%categoryList)) { + next if (@{$categoryList{$key}} == 0); + next if ($key eq ''); + $r->print('
' + .'

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

'."\n"); + foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) { + $r->print('' + .'
\n"); + $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} + : $tempkey) + .'
'."\n"); } + $r->print('
'); } - - $r->print("
\n"); + $r->print("\n"); } # # This function offers some links on the parameter section to get with one click a group a parameters @@ -1535,8 +1567,12 @@ sub shortCuts { sub partmenu { my ($r,$allparts,$psprt)=@_; + my $selsize = 1+scalar(keys(%{$allparts})); + if ($selsize > 8) { + $selsize = 8; + } - $r->print(''); $r->print(''); @@ -1657,13 +1693,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()); @@ -1737,12 +1773,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') .'' .'