--- loncom/interface/lonparmset.pm 2009/06/03 17:17:03 1.453 +++ loncom/interface/lonparmset.pm 2009/10/20 10:19:26 1.472 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.453 2009/06/03 17:17:03 schualex Exp $ +# $Id: lonparmset.pm,v 1.472 2009/10/20 10:19:26 amueller Exp $ # # Copyright Michigan State University Board of Trustees # @@ -854,7 +854,7 @@ sub page_js { return(< - +// $selscript ENDJS @@ -1184,7 +1185,7 @@ sub extractResourceInformation { $parmdis = $display; $parmdis =~ s/\s*\[Part.*$//g; } else { - $parmdis = $display; + $parmdis = &mt($display); } $$allparms{$name}=$parmdis; if (ref($defkeytype)) { @@ -1243,11 +1244,16 @@ sub isdateparm { return (($type=~/^date/) && (!($type eq 'date_interval'))); } +# +# 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. +# sub parmmenu { my ($r,$allparms,$pscat,$keyorder)=@_; my $tempkey; $r->print(< +// ENDSCRIPT - $r->print(); $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); #part to print selected parms overview - $r->print('' - .'' - .''); - $r->print(''); - $r->print('' - .'

'.&mt('Selected Parameters').': '); - - #print out all possible parms and hide it - $r->print('

'); - $r->print('
    '); + $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(' style="display:none"'); } - - $r->print('>'.($$allparms{$tempkey}=~/\s/ ? $$allparms{$tempkey} : $tempkey).'
    • '); - } - $r->print('('.&mt('add more parameter').')' - .'

'); + $r->print('>' + .($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey) + .'' + ); + } + $r->print('' + .'

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

' + ); &shortCuts($r,$allparms,$pscat,$keyorder); - $r->print(''); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); +} +# return a hash +sub categories { + return ('time_settings' => 'Time Settings', + 'grading' => 'Grading', + 'tries' => 'Tries', + 'problem_appearance' => 'Problem Appearance', + 'behaviour_of_input_fields' => 'Behaviour of Input Fields', + 'hiding' => 'Hiding', + 'high_level_randomization' => 'High Level Randomization', + 'slots' => 'Slots', + 'file_submission' => 'File Submission', + 'misc' => 'Miscellaneous' ); +} + +# return a hash. Like a look-up table +sub lookUpTableParameter { + + return ( + 'opendate' => 'time_settings', + 'duedate' => 'time_settings', + 'answerdate' => 'time_settings', + 'interval' => 'time_settings', + 'contentopen' => 'time_settings', + 'contentclose' => 'time_settings', + 'discussend' => 'time_settings', + 'weight' => 'grading', + 'handgrade' => 'grading', + 'maxtries' => 'tries', + 'hinttries' => 'tries', + 'type' => 'problem_appearance', + 'problemstatus' => 'problem_appearance', + 'display' => 'problem_appearance', + 'ordered' => 'problem_appearance', + 'numbubbles' => 'problem_appearance', + 'tol' => 'behaviour_of_input_fields', + 'sig' => 'behaviour_of_input_fields', + 'turnoffunit' => 'behaviour_of_input_fields', + 'hiddenresource' => 'hiding', + 'hiddenparts' => 'hiding', + 'discusshide' => 'hiding', + 'buttonshide' => 'hiding', + 'turnoffeditor' => 'hiding', + 'encrypturl' => 'hiding', + 'randomorder' => 'high_level_randomization', + 'randompick' => 'high_level_randomization', + 'available' => 'slots', + 'useslots' => 'slots', + 'availablestudent' => 'slots', + 'uploadedfiletypes' => 'file_submission', + 'maxfilesize' => 'file_submission', + 'cssfile' => 'misc', + 'mapalias' => 'misc', + 'acc' => 'misc', + 'maxcollaborators' => 'misc', + 'scoreformat' => 'misc', + + ); +} + +sub whatIsMyCategory { + my $name = shift; + my $catList = shift; + my @list; + my %lookUpList = &lookUpTableParameter; #Initilize the lookupList + my $cat = $lookUpList{$name}; + if (defined($cat)) { + if (!defined($$catList{$cat})){ + push @list, ($name); + $$catList{$cat} = \@list; + } else { + push @{${$catList}{$cat}}, ($name); + } + } else { + if (!defined($$catList{'misc'})){ + push @list, ($name); + $$catList{'misc'} = \@list; + } else { + push @{${$catList}{'misc'}}, ($name); + } + } +} + +sub keysindisplayorderCategory { + my ($name,$keyorder)=@_; + return sort { + $$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; + } ( @{$name}); +} + +sub category_order { + return ( + 'time_settings' => 1, + 'grading' => 2, + 'tries' => 3, + 'problem_appearance' => 4, + 'hiding' => 5, + 'behaviour_of_input_fields' => 6, + 'high_level_randomization' => 7, + 'slots' => 8, + 'file_submission' => 9, + 'misc' => 10 + ); + } sub parmboxes { my ($r,$allparms,$pscat,$keyorder)=@_; my $tempkey; - + my $tempparameter; + my %categories = &categories; + my %category_order = &category_order(); + my %categoryList = ( + 'time_settings' => [], + 'grading' => [], + 'tries' => [], + 'problem_appearance' => [], + 'behaviour_of_input_fields' => [], + 'hiding' => [], + 'high_level_randomization' => [], + 'slots' => [], + 'file_submission' => [], + 'misc' => [], + ); + foreach $tempparameter (keys %$allparms) { + &whatIsMyCategory($tempparameter, \%categoryList); + } #part to print the parm-list - $r->print('
'); + $r->print(''); } +# +# This function offers some links on the parameter section to get with one click a group a parameters +# sub shortCuts { my ($r,$allparms,$pscat,$keyorder)=@_; #part to print out the shortcuts for parmselection $r->print('' .'' .'' + .&Apache::loncommon::end_data_table_row() + ); + my $whitespace = ''; + if (exists($$allmaps{1})) { + $r->print(&Apache::loncommon::start_data_table_row() + .'' + .&Apache::loncommon::end_data_table_row() + ); + } + foreach my $id (@{$tree}) { + my ($mapid,$resid)=split(/\./,$id); + # Indentation + my $depth = $treeinfo->{$id}->{'depth'}; + my $indent; + for (my $i = 0; $i < $depth; $i++) { + $indent.= $whitespace; + } + $icon = ''; + if ($treeinfo->{$id}->{'type'} eq 'page') { + $icon = ''; + } + my $symb_name = $$symbp{$id}; + my ($front, $tail) = split (/___${resid}___/, $symb_name); + $symb_name = $tail; + $r->print(&Apache::loncommon::start_data_table_row() + .'' + .&Apache::loncommon::end_data_table_row() + ); + } + $r->print(&Apache::loncommon::end_data_table()); } - $r->print(""); - } sub levelmenu { @@ -1765,8 +2010,9 @@ sub assessparms { } elsif ($udom=$env{'request.role.domain'}) { } elsif ($udom=$env{'user.domain'}) { } else { - $udom=$r->dir_config('lonDefDomain'); + $udom=$r->dir_config('lonDefDomain'); } + my @pscat=&Apache::loncommon::get_env_multiple('form.pscat'); my $pschp=$env{'form.pschp'}; @@ -1786,62 +2032,61 @@ sub assessparms { if (($env{'form.command'} eq 'set') && ($env{'form.url'}) && (!$env{'form.dis'})) { - my $url=$env{'form.url'}; - $url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; - $pssymb=&Apache::lonnet::symbread($url); - if (!@pscat) { @pscat=('all'); } - $pschp=''; + my $url=$env{'form.url'}; + $url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; + $pssymb=&Apache::lonnet::symbread($url); + if (!@pscat) { @pscat=('all'); } + $pschp=''; $parmlev = 'full'; } elsif ($env{'form.symb'}) { - $pssymb=$env{'form.symb'}; - if (!@pscat) { @pscat=('all'); } - $pschp=''; + $pssymb=$env{'form.symb'}; + if (!@pscat) { @pscat=('all'); } + $pschp=''; $parmlev = 'full'; } else { - $env{'form.url'}=''; + $env{'form.url'}=''; } my $id=$env{'form.id'}; if (($id) && ($udom)) { - $uname=(&Apache::lonnet::idget($udom,$id))[1]; - if ($uname) { - $id=''; - } else { - $message= - ''.&mt("Unknown ID")." '$id' ". - &mt('at domain')." '$udom'"; - } + $uname=(&Apache::lonnet::idget($udom,$id))[1]; + if ($uname) { + $id=''; + } else { + $message= + ''.&mt("Unknown ID")." '$id' ". + &mt('at domain')." '$udom'"; + } } else { - $uname=$env{'form.uname'}; + $uname=$env{'form.uname'}; } unless ($udom) { $uname=''; } $uhome=''; if ($uname) { - $uhome=&Apache::lonnet::homeserver($uname,$udom); + $uhome=&Apache::lonnet::homeserver($uname,$udom); if ($uhome eq 'no_host') { - $message= - ''.&mt("Unknown user")." '$uname' ". - &mt("at domain")." '$udom'"; - $uname=''; + $message= + ''.&mt("Unknown user")." '$uname' ". + &mt("at domain")." '$udom'"; + $uname=''; } else { - $csec=&Apache::lonnet::getsection($udom,$uname, + $csec=&Apache::lonnet::getsection($udom,$uname, $env{'request.course.id'}); - - if ($csec eq '-1') { - $message=''. - &mt("User")." '$uname' ".&mt("at domain")." '$udom' ". - &mt("not in this course").""; - $uname=''; - $csec=$env{'form.csec'}; + if ($csec eq '-1') { + $message=''. + &mt("User")." '$uname' ".&mt("at domain")." '$udom' ". + &mt("not in this course").""; + $uname=''; + $csec=$env{'form.csec'}; $cgroup=$env{'form.cgroup'}; - } else { - my %name=&Apache::lonnet::userenvironment($udom,$uname, - ('firstname','middlename','lastname','generation','id')); - $message="\n

\n".&mt("Full Name").": ". - $name{'firstname'}.' '.$name{'middlename'}.' ' - .$name{'lastname'}.' '.$name{'generation'}. + } else { + my %name=&Apache::lonnet::userenvironment($udom,$uname, + ('firstname','middlename','lastname','generation','id')); + $message="\n

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

'; - } + } @usersgroups = &Apache::lonnet::get_users_groups( $udom,$uname,$env{'request.course.id'}); if (@usersgroups > 0) { @@ -1868,7 +2113,7 @@ sub assessparms { my @markers=split(/\&\&\&/,$env{'form.pres_marker'}); my @values=split(/\&\&\&/,$env{'form.pres_value'}); my @types=split(/\&\&\&/,$env{'form.pres_type'}); - for (my $i=0;$i<=$#markers;$i++) { + for (my $i=0;$i<=$#markers;$i++) { 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'}; @@ -1902,13 +2147,16 @@ sub assessparms { } } } - $message.=&storeparm(split(/\&/,$markers[$i]), + $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').'

'; + $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);} @@ -1919,34 +2167,55 @@ sub assessparms { &startpage($r); foreach ('tolerance','date_default','date_start','date_end', - 'date_interval','int','float','string') { - $r->print(''). '" name="recent_'.$_.'" />'); } + # ----- Start Parameter Selection + + # Hide parm selection? + $r->print(< +// + +ENDPARMSELSCRIPT + my $parmselhiddenstyle=' style="display:none"'; + if($env{'form.hideparmsel'} eq 'hidden') { + $r->print('
'); + } else { + $r->print('
'); + } + + # Display Unit 1 "General Parameters" if (!$pssymb) { $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters'))); $r->print(&Apache::lonhtmlcommon::start_pick_box()); &levelmenu($r,\%alllevs,$parmlev); - if ($parmlev ne 'general') { - $r->print(&Apache::lonhtmlcommon::row_closure()); - &mapmenu($r,\%allmaps,$pschp,\%maptitles); - } + if ($parmlev ne 'general') { + $r->print(&Apache::lonhtmlcommon::row_closure()); + &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp); + } - $r->print(&Apache::lonhtmlcommon::row_closure(1)); - $r->print(&Apache::lonhtmlcommon::end_pick_box()); - - &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); + $r->print(&Apache::lonhtmlcommon::row_closure(1)); + $r->print(&Apache::lonhtmlcommon::end_pick_box()); + #Display Unit 2 "Select Parameter" + &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); } else { my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); - my $title = &Apache::lonnet::gettitle($pssymb); + my $title = &Apache::lonnet::gettitle($pssymb); $r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). - ''. - '

'); + ''. + '

'); } $r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection'))); $r->print(&Apache::lonhtmlcommon::start_pick_box()); @@ -1954,10 +2223,32 @@ sub assessparms { $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); + # parm selection is shown: display parm update button + $r->print('

' + .'' + .'' + .'

' + ); + + $r->print('
'); + # ----- End Parameter Selection + + # Offer link to display parameter selection again + $r->print('' + ); - $r->print('

'.$message.'

'); + # Display Messages + $r->print('
'.$message.'
'); - $r->print('
'); my @temp_pscat; map { @@ -1974,101 +2265,101 @@ sub assessparms { my $csudom=$env{'user.domain'}; if ($parmlev eq 'full') { - my $coursespan=$csec?8:5; - my $userspan=3; - if ($cgroup ne '') { - $coursespan += 3; - } - - $r->print('

' - .'
'.&mt('Parameter Selection').'' + .'
'.&mt('Parameter Selection').'' .'' .'• '.&mt('Select All').'' .'' @@ -1421,7 +1559,7 @@ sub shortCuts { .'
' .'
' - .'
'.&mt('Add Selection for...').'' + .'
'.&mt('Add Selection for...').'' .'' .'• '.&mt('Problem Dates').'' .'' @@ -1500,6 +1638,7 @@ sub usermenu { $sections .= ' '.&mt('or').' '; $sections .= qq| |; } else { $sections .= qq| |; } @@ -1560,12 +1702,14 @@ function group_or_section(caller) { ,$chooseopt)); } +# +# This function shows on table Mode the available Parameters for the selected Resources +# sub displaymenu { my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_; $r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); $r->print(&Apache::lonhtmlcommon::start_pick_box()); &parmmenu($r,$allparms,$pscat,$keyorder); - #$r->print(&Apache::lonhtmlcommon::row_closure()); $r->print(&Apache::lonhtmlcommon::end_pick_box()); &parmboxes($r,$allparms,$pscat,$keyorder); $r->print(&Apache::lonhtmlcommon::start_pick_box()); @@ -1576,18 +1720,119 @@ sub displaymenu { } sub mapmenu { - my ($r,$allmaps,$pschp,$maptitles)=@_; - + 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 $curRes; + my $depth = 0; + my %parent = (); + my $startcount = 5; + my $lastcontainer = $startcount; +# preparing what is to show ... + while ($curRes = $it->next()) { + if ($curRes == $it->BEGIN_MAP()) { + $depth++; + $parent{$depth}= $lastcontainer; + } + if ($curRes == $it->END_MAP()) { + $depth--; + $lastcontainer = $parent{$depth}; + } + if (ref($curRes)) { + my $symb = $curRes->symb(); + my $ressymb = $symb; + if (($curRes->is_sequence()) || ($curRes->is_page())) { + my $type = 'sequence'; + if ($curRes->is_page()) { + $type = 'page'; + } + my $id= $curRes->id(); + my $srcf = $curRes->src(); + my $resource_name = &Apache::lonnet::gettitle($srcf); + if(!exists($treeinfo->{$id})) { + push(@$tree,$id); + my $enclosing_map_folder = &Apache::lonnet::declutter($curRes->enclosing_map_src()); + $treeinfo->{$id} = { + depth => $depth, + type => $type, + name => $resource_name, + enclosing_map_folder => $enclosing_map_folder, + }; + } + } + } + } + } +# Show it ... $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder'))); - $r->print('
'.$icon + .''.$icon + .'' + .''.$indent.$icon + .'' + .'
'); - $r->print(''); - $r->print(''); - if ($uname) { - if (@usersgroups > 1) { - $userspan ++; - } - $r->print('"); - } - 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", - 'type' => 'Type', - 'emof' => "Enclosing Map or Folder", - 'part' => 'Part', - 'pn' => 'Parameter Name', - 'def' => 'default', - 'femof' => 'from Enclosing Map or Folder', - 'gen' => 'general', - 'foremf' => 'for Enclosing Map or Folder', - 'fr' => 'for Resource' - ); - $r->print(<print('

'.&mt('Any User').''); - $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom
'); + $r->print(''); + $r->print(''); + if ($uname) { + if (@usersgroups > 1) { + $userspan ++; + } + $r->print('"); + } + 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", + 'type' => 'Type', + 'emof' => "Enclosing Map or Folder", + 'part' => 'Part', + 'pn' => 'Parameter Name', + 'def' => 'default', + 'femof' => 'from Enclosing Map or Folder', + 'gen' => 'general', + 'foremf' => 'for Enclosing Map or Folder', + 'fr' => 'for Resource' + ); + $r->print(<$lt{'pie'} ENDTABLETWO - if ($csec) { + if ($csec) { + $r->print('"); + } + if ($cgroup) { $r->print('"); - } - if ($cgroup) { - $r->print('"); - } - $r->print(<"); + } + $r->print(< ENDTABLEHEADFOUR - if ($csec) { - $r->print(''); - } - - if ($cgroup) { - $r->print(''); - } - - if ($uname) { - if (@usersgroups > 1) { - $r->print(''); - } - $r->print(''); - } - - $r->print(''); - - my $defbgone=''; - my $defbgtwo=''; - my $defbgthree = ''; + if ($csec) { + $r->print(''); + } + + if ($cgroup) { + $r->print(''); + } + + if ($uname) { + if (@usersgroups > 1) { + $r->print(''); + } + $r->print(''); + } + + $r->print(''); + + my $defbgone=''; + my $defbgtwo=''; + my $defbgthree = ''; - foreach (@ids) { + foreach (@ids) { - my $rid=$_; + my $rid=$_; my ($inmapid)=($rid=~/\.(\d+)$/); if ((!$pssymb && - (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}))) - || - ($pssymb && $pssymb eq $symbp{$rid})) { + (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}))) + || + ($pssymb && $pssymb eq $symbp{$rid})) { # ------------------------------------------------------ Entry for one resource - if ($defbgone eq '#E0E099') { - $defbgone='#E0E0DD'; + if ($defbgone eq '#E0E099') { + $defbgone='#E0E0DD'; } else { $defbgone='#E0E099'; } if ($defbgtwo eq '#FFFF99') { - $defbgtwo='#FFFFDD'; + $defbgtwo='#FFFFDD'; } else { - $defbgtwo='#FFFF99'; + $defbgtwo='#FFFF99'; } if ($defbgthree eq '#FFBB99') { $defbgthree='#FFBBDD'; @@ -2109,21 +2400,21 @@ ENDTABLEHEADFOUR } my $totalparms=scalar keys %name; if ($totalparms>0) { - my $firstrow=1; - my $title=&Apache::lonnet::gettitle($symbp{$rid}); + my $firstrow=1; + my $title=&Apache::lonnet::gettitle($symbp{$rid}); $r->print(''); $r->print('
'.&mt('Any User').''); + $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom$lt{'csv'}
($csuname $lt{'at'} $csudom)
$lt{'ic'}$lt{'rl'} $lt{'ic'}'. + &mt("in Section")." $csec'. - &mt("in Section")." $csec'. - &mt("in Group")." $cgroup
$lt{'aut'}$lt{'type'} $lt{'emof'}$lt{'part'}$lt{'pn'} $lt{'gen'}$lt{'foremf'} $lt{'def'}$lt{'femof'}$lt{'fr'}'.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').''.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').''.&mt('Control by other group?').''.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').'
'.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').''.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').''.&mt('Control by other group?').''.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').'
'. join(' / ',split(/\//,$uri)). '

'. "$title"); if ($thistitle) { - $r->print(' ('.$thistitle.')'); + $r->print(' ('.$thistitle.')'); } $r->print('

print("Catmarker: @catmarker
\n"); foreach (@ids) { - ($map)=(/([\d]*?)\./); - my $rid = $_; + ($map)=(/([\d]*?)\./); + my $rid = $_; # $r->print("$mapid:$map: $rid
\n"); - if ($map eq $mapid) { - my $uri=&Apache::lonnet::declutter($uris{$rid}); + if ($map eq $mapid) { + my $uri=&Apache::lonnet::declutter($uris{$rid}); # $r->print("Keys: $keyp{$rid}
\n"); #-------------------------------------------------------------------- @@ -2198,32 +2489,32 @@ ENDTABLEHEADFOUR # When storing information, store as part 0 # When requesting information, request from full part #------------------------------------------------------------------- - foreach (&keysplit($keyp{$rid})) { - my $tempkeyp = $_; - my $fullkeyp = $tempkeyp; - $tempkeyp =~ s/_\w+_/_0_/; - - if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { - $part{$tempkeyp}="0"; - $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); - my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); - if ($allparms{$name{$tempkeyp}} ne '') { - my $identifier; - if ($parmdis =~ /(\s*\[Part.*)$/) { - $identifier = $1; - } - $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; - } else { - $display{$tempkeyp} = $parmdis; - } - unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } - $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; - $display{$tempkeyp} =~ s/_\w+_/_0_/; - $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); - $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); - } - } # end loop through keys - } + foreach (&keysplit($keyp{$rid})) { + my $tempkeyp = $_; + my $fullkeyp = $tempkeyp; + $tempkeyp =~ s/_\w+_/_0_/; + + if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { + $part{$tempkeyp}="0"; + $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); + my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); + if ($allparms{$name{$tempkeyp}} ne '') { + my $identifier; + if ($parmdis =~ /(\s*\[Part.*)$/) { + $identifier = $1; + } + $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; + } else { + $display{$tempkeyp} = $parmdis; + } + unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } + $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; + $display{$tempkeyp} =~ s/_\w+_/_0_/; + $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); + $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); + } + } # end loop through keys + } } # end loop through ids #---------------------------------------------------- print header information @@ -2231,7 +2522,7 @@ ENDTABLEHEADFOUR my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); my $tmp=""; if ($uname) { - my $person=&Apache::loncommon::plainname($uname,$udom); + my $person=&Apache::loncommon::plainname($uname,$udom); $tmp.=&mt("User")." $uname \($person\) ". &mt('in')." \n"; } else { @@ -2262,8 +2553,8 @@ ENDTABLEHEADFOUR .&Apache::loncommon::end_data_table_header_row() ); - foreach (&keysinorder(\%name,\%keyorder)) { - $r->print(&Apache::loncommon::start_data_table_row()); + foreach (&keysinorder(\%name,\%keyorder)) { + $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, $parmlev,$uname,$udom,$csec,$cgroup); @@ -2275,7 +2566,7 @@ ENDTABLEHEADFOUR } # end of $parmlev eq map #--------------------------------- Entry for parm level general (Course level) if ($parmlev eq 'general') { - my $defbgone = '#E0E099'; + my $defbgone = '#E0E099'; my $defbgtwo = '#FFFF99'; my $defbgthree = '#FFBB99'; @@ -2301,41 +2592,41 @@ ENDTABLEHEADFOUR # When storing information, store as part 0 # When requesting information, request from full part #------------------------------------------------------------------- - foreach (&keysplit($keyp{$rid})) { - my $tempkeyp = $_; - my $fullkeyp = $tempkeyp; - $tempkeyp =~ s/_\w+_/_0_/; - if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { - $part{$tempkeyp}="0"; - $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); - my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); - if ($allparms{$name{$tempkeyp}} ne '') { - my $identifier; - if ($parmdis =~ /(\s*\[Part.*)$/) { - $identifier = $1; - } - $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; - } else { - $display{$tempkeyp} = $parmdis; - } - unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } - $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; - $display{$tempkeyp} =~ s/_\w+_/_0_/; - $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); - $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); - } + foreach (&keysplit($keyp{$rid})) { + my $tempkeyp = $_; + my $fullkeyp = $tempkeyp; + $tempkeyp =~ s/_\w+_/_0_/; + if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { + $part{$tempkeyp}="0"; + $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); + my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); + if ($allparms{$name{$tempkeyp}} ne '') { + my $identifier; + if ($parmdis =~ /(\s*\[Part.*)$/) { + $identifier = $1; + } + $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier; + } else { + $display{$tempkeyp} = $parmdis; + } + unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } + $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; + $display{$tempkeyp} =~ s/_\w+_/_0_/; + $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); + $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); + } } # end loop through keys } # end loop through ids #---------------------------------------------------- print header information - my $setdef=&mt("Set Defaults for All Resources in Course"); + my $setdef=&mt("Set Defaults for All Resources in Course"); $r->print(<

$setdef $coursename
ENDMAPONE if ($uname) { - my $person=&Apache::loncommon::plainname($uname,$udom); + my $person=&Apache::loncommon::plainname($uname,$udom); $r->print(" ".&mt("User")." $uname \($person\) \n"); } else { $r->print(" ".&mt("ALL")." ".&mt("USERS")." \n"); @@ -2353,7 +2644,7 @@ ENDMAPONE .&Apache::loncommon::end_data_table_header_row() ); - foreach (&keysinorder(\%name,\%keyorder)) { + foreach (&keysinorder(\%name,\%keyorder)) { $r->print(&Apache::loncommon::start_data_table_row()); &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo,$defbgthree, @@ -2647,9 +2938,10 @@ sub listdata { # # Ready to print # + my $parmitem = &standard_parameter_names($name); $r->print(&tablestart(). &Apache::loncommon::start_data_table_row(). - '

'.&standard_parameter_names($name). + ''.&mt($parmitem). ''); $foundkeys++; @@ -2865,7 +3157,7 @@ ENDOVER #$r->print(' #
'); - $r->print('
'); + $r->print('
'); #$r->print('

Step 1

'); $r->print('
'); $r->print(&Apache::lonhtmlcommon::start_pick_box()); @@ -2883,11 +3175,10 @@ ENDOVER #$r->print(' #
'); - $r->print('
'); + $r->print('
'); $r->print('
'); $r->print(&Apache::lonhtmlcommon::start_pick_box()); &parmmenu($r,\%allparms,\@pscat,\%keyorder); - #$r->print(&Apache::lonhtmlcommon::row_closure()); $r->print(&Apache::lonhtmlcommon::end_pick_box()); &parmboxes($r,\%allparms,\@pscat,\%keyorder); $r->print(&Apache::lonhtmlcommon::start_pick_box()); @@ -2907,7 +3198,7 @@ ENDOVER $r->print(&Apache::lonhtmlcommon::end_pick_box()); $r->print('
'); - $r->print('
'); + $r->print('
'); $r->print('
'); my $sortorder=$env{'form.sortorder'}; unless ($sortorder) { $sortorder='realmstudent'; } @@ -3064,9 +3355,10 @@ ENDOVER $display_value = &Apache::lonlocal::locallocaltime($display_value); } + my $parmitem = &standard_parameter_names($data{'parameter_name'}); + $parmitem = &mt($parmitem); $r->print(&mt('Parameter: "[_1]" with value: "[_2]"', - &standard_parameter_names($data{'parameter_name'}), - $resourcedata->{$thiskey})); + $parmitem,$resourcedata->{$thiskey})); $r->print('
'); if ($data{'scope_type'} eq 'all') { $r->print(&mt('All users')); @@ -3928,7 +4220,7 @@ sub components { } my %standard_parms; - +my %standard_parms_types; sub load_parameter_names { open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); @@ -3939,12 +4231,13 @@ sub load_parameter_names { my (undef,$name,$type)=split(/\&/,$short,3); if ($type eq 'display') { $standard_parms{$name} = $plain; - } + } elsif ($type eq 'type') { + $standard_parms_types{$name} = $plain; + } } close($config); $standard_parms{'int_pos'} = 'Positive Integer'; $standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; - %standard_parms=&Apache::lonlocal::texthash(%standard_parms); } sub standard_parameter_names { @@ -3959,7 +4252,16 @@ sub standard_parameter_names { } } - +sub standard_parameter_types { + my ($name)=@_; + if (!%standard_parms_types) { + &load_parameter_names(); + } + if ($standard_parms_types{$name}) { + return $standard_parms_types{$name}; + } + return; +} sub parm_change_log { my ($r)=@_; @@ -4057,23 +4359,37 @@ sub parm_change_log { } else { $makenewrow=1; } + my $parmitem = &standard_parameter_names($parmname); $output .='
'.$realm.''.$section.''. - &standard_parameter_names($parmname).''. + &mt($parmitem).''. ($part?&mt('Part: [_1]',$part):&mt('All Parts')).''; my $stillactive=0; if ($parmlog{$id}{'delflag'}) { $output .= &mt('Deleted'); } else { if ($typeflag) { - $output .= &mt('Type: [_1]',&standard_parameter_names($value)); + my $parmitem = &standard_parameter_names($value); + $parmitem = &mt($parmitem); + $output .= &mt('Type: [_1]',$parmitem); } else { my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), $uname,$udom,$issection,$issection,$courseopt); - if (&isdateparm($istype{$parmname})) { - $output .= &Apache::lonlocal::locallocaltime($value); - } else { - $output .= $value; - } + my $showvalue = $value; + if ($istype{$parmname} eq '') { + my $type = &standard_parameter_types($parmname); + if ($type ne '') { + if (&isdateparm($type)) { + $showvalue = + &Apache::lonlocal::locallocaltime($value); + } + } + } else { + if (&isdateparm($istype{$parmname})) { + $showvalue = + &Apache::lonlocal::locallocaltime($value); + } + } + $output .= $showvalue; if ($value ne $all[$level]) { $output .= '
'.&mt('Not active anymore').''; } else { @@ -4082,9 +4398,13 @@ sub parm_change_log { } } $output .= '
'; + if ($stillactive) { - my $title=&mt('Changed [_1]',&standard_parameter_names($parmname)); - my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription, + my $parmitem = &standard_parameter_names($parmname); + $parmitem = &mt($parmitem); + my $title=&mt('Changed [_1]',$parmitem); + my $description=&mt('Changed [_1] for [_2] to [_3]', + $parmitem,$realmdescription, (&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); if (($uname) && ($udom)) { $output .=