--- loncom/interface/lonparmset.pm 2011/10/07 15:25:40 1.505.2.1 +++ 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.505.2.1 2011/10/07 15:25:40 raeburn Exp $ +# $Id: lonparmset.pm,v 1.536 2013/07/10 22:07:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -137,33 +137,41 @@ 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: -=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]" +=item * B (out) : An array that will contain all of the ids in the course. -=item * B : hash, full key to part->display value (what's display value?) +=item * B(out) : hash, id->type, where "type" contains the extension of the file, thus, I. -=item * B : hash, ??? +=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 : ??? +=item * B (out) : hash, name of parameter->display value (what is the display value?) -=item * B : hash, ??? +=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 =item isdateparm() @@ -196,8 +204,8 @@ 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): @@ -302,9 +310,35 @@ use Apache::lonlocal; use Apache::lonnavmaps; use Apache::longroup; use Apache::lonrss; +use HTML::Entities; use LONCAPA qw(:DEFAULT :match); +sub startSettingsScreen { + my ($r,$mode,$crstype)=@_; + + my $tabtext = &mt('Course Settings'); + if ($crstype eq 'Community') { + $tabtext = &mt('Community Settings'); + } + $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, @@ -631,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 { @@ -738,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); @@ -783,6 +820,7 @@ sub valout { &date_sanity_info($value); } else { $result = $value; + $result=~s/\,/\, /gs; $result = &HTML::Entities::encode($result,'"<>&'); } } @@ -824,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'})) { @@ -884,20 +942,31 @@ 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',$crstype); $r->print(< + + ENDHEAD } @@ -930,7 +999,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; } @@ -1041,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])); @@ -1138,6 +1211,7 @@ sub extractResourceInformation { $$typep{$id}=$1; $$keyp{$id}=''; $$uris{$id}=$srcf; + foreach my $key (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) { next if ($key!~/^parameter_/); @@ -1193,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}); } @@ -1237,14 +1311,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('
'); $r->print('
'); &shortCuts($r,$allparms,$pscat,$keyorder); $r->print('
'); - - $r->print( - '

' - .&mt('Show detailed Parameter Selection') - .'

' - ); - - $r->print(&Apache::lonhtmlcommon::row_closure(1)); } # return a hash sub categories { @@ -1372,6 +1401,8 @@ sub lookUpTableParameter { 'contentopen' => 'time_settings', 'contentclose' => 'time_settings', 'discussend' => 'time_settings', + 'printopendate' => 'time_settings', + 'printclosedate' => 'time_settings', 'weight' => 'grading', 'handgrade' => 'grading', 'maxtries' => 'tries', @@ -1403,7 +1434,10 @@ sub lookUpTableParameter { 'acc' => 'misc', 'maxcollaborators' => 'misc', 'scoreformat' => 'misc', - + 'lenient' => 'grading', + 'retrypartial' => 'tries', + 'discussvote' => 'misc', + 'examcode' => 'high_level_randomization', ); } @@ -1471,56 +1505,30 @@ sub parmboxes { 'file_submission' => [], 'misc' => [], ); - my $hidelink = - '

' - .'' - .&mt('Hide detailed Parameter Selection') - .'' - .'

' - ."\n"; -; + foreach $tempparameter (keys %$allparms) { &whatIsMyCategory($tempparameter, \%categoryList); } #part to print the parm-list - $r->print( - '\n" - ); + $r->print("\n"); } # # This function offers some links on the parameter section to get with one click a group a parameters @@ -1559,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(''); @@ -1681,11 +1693,19 @@ 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::loncommon::end_scrollbox()); + + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + } sub mapmenu { @@ -1749,15 +1769,16 @@ sub mapmenu { $r->print( '
' .&mt('You can only select maps and folders which have modifiable settings.') - .' '.&Apache::loncommon::help_open_topic('Parameter_Set_Folder') + .' '.&Apache::loncommon::help_open_topic('Parameter_Set_Folder') .'
' ); - $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') .'' .'