--- loncom/interface/lonparmset.pm 2003/06/04 18:22:52 1.96 +++ loncom/interface/lonparmset.pm 2005/06/02 13:15:05 1.198 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.96 2003/06/04 18:22:52 albertel Exp $ +# $Id: lonparmset.pm,v 1.198 2005/06/02 13:15:05 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -58,30 +58,34 @@ use Apache::lonnet; use Apache::Constants qw(:common :http REDIRECT); use Apache::lonhtmlcommon(); use Apache::loncommon; -use Apache::lonmenu; use GDBM_File; use Apache::lonhomework; use Apache::lonxml; +use Apache::lonlocal; +use Apache::lonnavmaps; +# --- Caches local to lonparmset -my %courseopt; -my %useropt; -my %parmhash; +my $courseoptid=''; +my %courseopt=(); +my $useroptid=''; +my %useropt=(); +my $parmhashid=''; +my %parmhash=(); +# --- end local caches + +# +# FIXME: get rid of items below +# my @ids; my %symbp; my %mapp; my %typep; my %keyp; - +my %uris; my %maptitles; -my $uname; -my $udom; -my $uhome; -my $csec; -my $coursename; - ################################################## ################################################## @@ -97,10 +101,10 @@ Inputs: $what - a parameter spec (inclu Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 11 possible levels -11- resource default -10- map default -9 - General Course -8 - Map or Folder level in course +11 - General Course +10 - Map or Folder level in course +9- resource default +8- map default 7 - resource level in course 6 - General for section 5 - Map or Folder level for section @@ -114,7 +118,10 @@ Returns: A list, the first item is the ################################################## ################################################## sub parmval { - my ($what,$id,$def)=@_; + my ($what,$id,$def,$uname,$udom,$csec)=@_; +# load caches + &cacheparmhash(); + my $result=''; my @outpar=(); # ----------------------------------------------------- Cascading lookup scheme @@ -122,40 +129,43 @@ sub parmval { my $symbparm=$symbp{$id}.'.'.$what; my $mapparm=$mapp{$id}.'___(all).'.$what; - my $seclevel=$ENV{'request.course.id'}.'.['.$csec.'].'.$what; - my $seclevelr=$ENV{'request.course.id'}.'.['.$csec.'].'.$symbparm; - my $seclevelm=$ENV{'request.course.id'}.'.['.$csec.'].'.$mapparm; - - my $courselevel=$ENV{'request.course.id'}.'.'.$what; - my $courselevelr=$ENV{'request.course.id'}.'.'.$symbparm; - my $courselevelm=$ENV{'request.course.id'}.'.'.$mapparm; + my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$what; + my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; + my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; -# -------------------------------------------------------- first, check default + my $courselevel=$env{'request.course.id'}.'.'.$what; + my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; + my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; - if ($def) { $outpar[11]=$def; $result=11; } -# ----------------------------------------------------- second, check map parms - my $thisparm=$parmhash{$symbparm}; - if ($thisparm) { $outpar[10]=$thisparm; $result=10; } - -# --------------------------------------------------------- third, check course +# --------------------------------------------------------- first, check course if (defined($courseopt{$courselevel})) { - $outpar[9]=$courseopt{$courselevel}; - $result=9; + $outpar[11]=$courseopt{$courselevel}; + $result=11; } if (defined($courseopt{$courselevelm})) { - $outpar[8]=$courseopt{$courselevelm}; - $result=8; + $outpar[10]=$courseopt{$courselevelm}; + $result=10; } +# ------------------------------------------------------- second, check default + + if (defined($def)) { $outpar[9]=$def; $result=9; } + +# ------------------------------------------------------ third, check map parms + + my $thisparm=$parmhash{$symbparm}; + if (defined($thisparm)) { $outpar[8]=$thisparm; $result=8; } + if (defined($courseopt{$courselevelr})) { $outpar[7]=$courseopt{$courselevelr}; $result=7; } +# ------------------------------------------------------ fourth, back to course if (defined($csec)) { if (defined($courseopt{$seclevel})) { $outpar[6]=$courseopt{$seclevel}; @@ -172,7 +182,7 @@ sub parmval { } } -# ---------------------------------------------------------- fourth, check user +# ---------------------------------------------------------- fifth, check user if (defined($uname)) { if (defined($useropt{$courselevel})) { @@ -193,6 +203,151 @@ sub parmval { return ($result,@outpar); } +sub resetparmhash { + $parmhashid=''; +} + +sub cacheparmhash { + if ($parmhashid eq $env{'request.course.fn'}) { return; } + my %parmhashfile; + if (tie(%parmhashfile,'GDBM_File', + $env{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640)) { + %parmhash=%parmhashfile; + untie %parmhashfile; + $parmhashid=$env{'request.course.fn'}; + } +} + +sub cacheuseropt { + my ($uname,$udom)=@_; +} + +sub cachecourseopt { +} + +################################################## +################################################## +# +# Store a parameter by ID +# +# Takes +# - resource id +# - name of parameter +# - level +# - new value +# - new type +# - username +# - userdomain + +sub storeparm { + my ($sresid,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; + my $navmap = Apache::lonnavmaps::navmap->new(); + if ($sresid=~/\./) { + my $resource=$navmap->getById($sresid); + &storeparm_by_symb($resource->symb(),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec); + } else { + my $resource=$navmap->getByMapPc($sresid); + &storeparm_by_symb(&Apache::lonnet::declutter($resource->src()),$spnam,$snum,$nval,$ntype,$uname,$udom,$csec); + } +} + +# +# Store a parameter by symb +# +# Takes +# - symb +# - name of parameter +# - level +# - new value +# - new type +# - username +# - userdomain + +sub storeparm_by_symb { +# ---------------------------------------------------------- Get symb, map, etc + my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; +# ---------------------------------------------------------- Construct prefixes + $spnam=~s/\_([^\_]+)$/\.$1/; + my $map=(&Apache::lonnet::decode_symb($symb))[0]; + my $symbparm=$symb.'.'.$spnam; + my $mapparm=$map.'___(all).'.$spnam; + + my $seclevel=$env{'request.course.id'}.'.['.$csec.'].'.$spnam; + my $seclevelr=$env{'request.course.id'}.'.['.$csec.'].'.$symbparm; + my $seclevelm=$env{'request.course.id'}.'.['.$csec.'].'.$mapparm; + + my $courselevel=$env{'request.course.id'}.'.'.$spnam; + my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; + my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; + + my $storeunder=''; + if (($snum==11) || ($snum==3)) { $storeunder=$courselevel; } + if (($snum==10) || ($snum==2)) { $storeunder=$courselevelm; } + if (($snum==7) || ($snum==1)) { $storeunder=$courselevelr; } + if ($snum==6) { $storeunder=$seclevel; } + if ($snum==5) { $storeunder=$seclevelm; } + if ($snum==4) { $storeunder=$seclevelr; } + + my $delete; + if ($nval eq '') { $delete=1;} + my %storecontent = ($storeunder => $nval, + $storeunder.'.type' => $ntype); + my $reply=''; + if ($snum>3) { +# ---------------------------------------------------------------- Store Course +# +# Expire sheets + &Apache::lonnet::expirespread('','','studentcalc'); + if (($snum==7) || ($snum==4)) { + &Apache::lonnet::expirespread('','','assesscalc',$symb); + } elsif (($snum==8) || ($snum==5)) { + &Apache::lonnet::expirespread('','','assesscalc',$map); + } else { + &Apache::lonnet::expirespread('','','assesscalc'); + } +# Store parameter + if ($delete) { + $reply=&Apache::lonnet::del + ('resourcedata',[keys(%storecontent)], + $env{'course.'.$env{'request.course.id'}.'.domain'}, + $env{'course.'.$env{'request.course.id'}.'.num'}); + } else { + $reply=&Apache::lonnet::cput + ('resourcedata',\%storecontent, + $env{'course.'.$env{'request.course.id'}.'.domain'}, + $env{'course.'.$env{'request.course.id'}.'.num'}); + } + } else { +# ------------------------------------------------------------------ Store User +# +# Expire sheets + &Apache::lonnet::expirespread($uname,$udom,'studentcalc'); + if ($snum==1) { + &Apache::lonnet::expirespread + ($uname,$udom,'assesscalc',$symb); + } elsif ($snum==2) { + &Apache::lonnet::expirespread + ($uname,$udom,'assesscalc',$map); + } else { + &Apache::lonnet::expirespread($uname,$udom,'assesscalc'); + } +# Store parameter + if ($delete) { + $reply=&Apache::lonnet::del + ('resourcedata',[keys(%storecontent)],$udom,$uname); + } else { + $reply=&Apache::lonnet::cput + ('resourcedata',\%storecontent,$udom,$uname); + } + &Apache::lonnet::devalidateuserresdata($uname,$udom); + } + + if ($reply=~/^error\:(.*)/) { + return "Write Error: $1"; + } + return ''; +} + ################################################## ################################################## @@ -273,9 +428,9 @@ sub plink { my $winvalue=$value; unless ($winvalue) { if ($type=~/^date/) { - $winvalue=$ENV{'form.recent_'.$type}; + $winvalue=$env{'form.recent_'.$type}; } else { - $winvalue=$ENV{'form.recent_'.(split(/\_/,$type))[0]}; + $winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; } } return @@ -286,20 +441,34 @@ sub plink { sub startpage { - my ($r,$id,$udom,$csec,$uname)=@_; - - my $bodytag=&Apache::lonmenu::registerurl(). - &Apache::loncommon::bodytag('Set Course Parameters','', - 'onUnload="'. - &Apache::lonmenu::unloadevents().';pclose();" onLoad="'. - &Apache::lonmenu::loadevents().'"'). - &Apache::lonmenu::regflush(); + my ($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader)=@_; + + my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', + 'onUnload="pclose()"'); + my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table'); my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '. &Apache::loncommon::selectstudent_link('parmform','uname','udom'); my $selscript=&Apache::loncommon::studentbrowser_javascript(); my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition(); + my %lt=&Apache::lonlocal::texthash( + 'cep' => "Course Environment Parameters", + 'scep' => "Set Course Environment Parameters", + 'smcap' => "Set/Modify Course Assessment Parameter", + 'mcap' => "Modify Course Assessment Parameters", + 'caphm' => "Course Assessment Parameter - Helper Mode", + 'capom' => "Course Assessment Parameters - Overview Mode", + 'captm' => "Course Assessments Parameters - Table Mode", + 'sg' => "Section/Group", + 'fu' => "For User", + 'oi' => "or ID", + 'ad' => "at Domain" + ); + my $overallhelp= + &Apache::loncommon::help_open_menu('','Setting Parameters','Course_Setting_Parameters','',10,'Instructor Interface'); + my $assessparmhelp=&Apache::loncommon::help_open_topic("Cascading_Parameters","Assessment Parameters"); + my $html=&Apache::lonxml::xmlbegin(); $r->print(< +$html LON-CAPA Course Parameters + + + + +'); $r->print(''); # $r->print('Select Parts'); $r->print(''); $r->print('print(' selected') unless (@psprt); - $r->print('>All Parts'); + $r->print('>'.&mt('All Parts').''); my %temphash=(); foreach (@psprt) { $temphash{$_}=1; } foreach $tempkey (sort keys %allparts) { @@ -988,9 +1128,9 @@ sub assessparms { } $r->print(''); - $r->print('Sort list by'); + $r->print(''.&mt('Sort list by').''); $r->print(''); - $r->print('Enclosing Map or Folder'); + $r->print(''.&mt('Enclosing Map or Folder').''); foreach (sort keys %allkeys) { $r->print('print(' selected'); } @@ -1025,7 +1165,13 @@ sub assessparms { } } - $r->print(''); + $r->print(''); + if (($prevvisit) || ($pschp) || ($pssymb)) { + $submitmessage = &mt("Update Course Assessment Parameter Display"); + } else { + $submitmessage = &mt("Set/Modify Course Assessment Parameters"); + } + $r->print(''); # my @temp_psprt; # foreach my $t (@psprt) { @@ -1045,42 +1191,59 @@ sub assessparms { if (($prevvisit) || ($pschp) || ($pssymb)) { # ----------------------------------------------------------------- Start Table my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat; - my $csuname=$ENV{'user.name'}; - my $csudom=$ENV{'user.domain'}; - + my $csuname=$env{'user.name'}; + my $csudom=$env{'user.domain'}; if ($parmlev eq 'full' || $parmlev eq 'brief') { - my $coursespan=$csec?8:5; $r->print(''); $r->print(''); - $r->print('Any User'); + $r->print(''.&mt('Any User').''); if ($uname) { $r->print(""); - $r->print("User $uname at Domain $udom"); + $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom"); } + 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(<Parameter in Effect -Current Session Value($csuname at $csudom) -Resource Level -in Course +$lt{'pie'} +$lt{'csv'}($csuname $lt{'at'} $csudom) +$lt{'ic'}$lt{'rl'} +$lt{'ic'} + ENDTABLETWO if ($csec) { - $r->print("in Section/Group $csec"); + $r->print("". + &mt("in Section/Group")." $csec"); } $r->print(<Assessment URL and TitleType -Enclosing Map or FolderPart No.Parameter Name -defaultfrom Enclosing Map or Folder -generalfor Enclosing Map or Folderfor Resource +$lt{'aut'}$lt{'type'} +$lt{'emof'}$lt{'part'}$lt{'pn'} +$lt{'gen'}$lt{'foremf'} +$lt{'def'}$lt{'femof'}$lt{'fr'} ENDTABLEHEADFOUR if ($csec) { - $r->print('generalfor Enclosing Map or Folderfor Resource'); + $r->print(''.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').''); } if ($uname) { - $r->print('generalfor Enclosing Map or Folderfor Resource'); + $r->print(''.&mt('general').''.&mt('for Enclosing Map or Folder').''.&mt('for Resource').''); } $r->print(''); @@ -1093,18 +1256,20 @@ ENDTABLEHEADFOUR my $rid=$_; my ($inmapid)=($rid=~/\.(\d+)$/); - if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) || - ($pssymb eq $symbp{$rid})) { + if ((!$pssymb && + (($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"'; + $defbgone='"#E0E099"'; } - if ($defbgtwo eq '"FFFF99"') { - $defbgtwo='"FFFFDD"'; + if ($defbgtwo eq '"#FFFF99"') { + $defbgtwo='"#FFFFDD"'; } else { - $defbgtwo='"FFFF99"'; + $defbgtwo='"#FFFF99"'; } my $thistitle=''; my %name= (); @@ -1113,7 +1278,7 @@ ENDTABLEHEADFOUR my %display=(); my %type= (); my %default=(); - my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); + my $uri=&Apache::lonnet::declutter($uris{$rid}); foreach (split(/\,/,$keyp{$rid})) { my $tempkeyp = $_; @@ -1131,15 +1296,16 @@ ENDTABLEHEADFOUR my $totalparms=scalar keys %name; if ($totalparms>0) { my $firstrow=1; - + my $title=&Apache::lonnet::gettitle($uri); $r->print(''. join(' / ',split(/\//,$uri)). ''. - "$bighash{'title_'.$rid}"); + " TARGET=_self>$title"); if ($thistitle) { $r->print(' ('.$thistitle.')'); @@ -1167,7 +1333,7 @@ ENDTABLEHEADFOUR &print_row($r,$_,\%part,\%name,$rid,\%default, \%type,\%display,$defbgone,$defbgtwo, - $parmlev); + $parmlev,$uname,$udom,$csec); } } } @@ -1211,7 +1377,7 @@ ENDTABLEHEADFOUR # $r->print("$mapid:$map: $rid \n"); if ($map eq $mapid) { - my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); + my $uri=&Apache::lonnet::declutter($uris{$rid}); # $r->print("Keys: $keyp{$rid} \n"); #-------------------------------------------------------------------- @@ -1241,12 +1407,12 @@ ENDTABLEHEADFOUR } # end loop through ids #---------------------------------------------------- print header information - my $foldermap=($maptitle=~/^uploaded/?'Folder':'Map'); + my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); $r->print(< -Set Defaults for All Resources in $foldermap -$showtitle +Set Defaults for All Resources in $foldermap +$showtitle Specifically for ENDMAPONE if ($uname) { @@ -1254,25 +1420,28 @@ ENDMAPONE ('firstname','middlename','lastname','generation', 'id')); my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}; - $r->print("User $uname \($person\) in \n"); + $r->print(&mt("User")." $uname \($person\) ". + &mt('in')." \n"); } else { - $r->print("all users in \n"); + $r->print("".&mt('all').' '.&mt('users in')." \n"); } - if ($csec) {$r->print("Section $csec of \n")}; + if ($csec) {$r->print(&mt("Section")." $csec ". + &mt('of')." \n")}; - $r->print("$coursename"); - $r->print("\n"); + $r->print("$coursename"); + $r->print("\n"); #---------------------------------------------------------------- print table $r->print(''); - $r->print('Parameter Name'); - $r->print('Default Value'); - $r->print('Parameter in Effect'); + $r->print(''.&mt('Parameter Name').''); + $r->print(''.&mt('Default Value').''); + $r->print(''.&mt('Parameter in Effect').''); foreach (sort keys %name) { + $r->print(''); &print_row($r,$_,\%part,\%name,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo, - $parmlev); + $parmlev,$uname,$udom,$csec); # $r->print("resource.$part{$_}.$name{$_},$symbp{$mapid}\n"); } $r->print(""); @@ -1296,7 +1465,7 @@ ENDMAPONE foreach (@ids) { my $rid = $_; - my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); + my $uri=&Apache::lonnet::declutter($uris{$rid}); #-------------------------------------------------------------------- # @catmarker contains list of all possible parameters including part #s @@ -1323,40 +1492,39 @@ ENDMAPONE } # end loop through ids #---------------------------------------------------- print header information + my $setdef=&mt("Set Defaults for All Resources in Course"); $r->print(< -Set Defaults for All Resources in Course -$coursename +$setdef +$coursename ENDMAPONE if ($uname) { my %name=&Apache::lonnet::userenvironment($udom,$uname, ('firstname','middlename','lastname','generation', 'id')); my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}; - $r->print(" User $uname \($person\) \n"); + $r->print(" ".&mt("User")." $uname \($person\) \n"); } else { - $r->print("ALL USERS \n"); + $r->print(" ".&mt("ALL")." ".&mt("USERS")." \n"); } - if ($csec) {$r->print("Section $csec\n")}; - $r->print("\n"); + if ($csec) {$r->print(&mt("Section")." $csec\n")}; + $r->print("\n"); #---------------------------------------------------------------- print table $r->print(''); - $r->print('Parameter Name'); - $r->print('Default Value'); - $r->print('Parameter in Effect'); + $r->print(''.&mt('Parameter Name').''); + $r->print(''.&mt('Default Value').''); + $r->print(''.&mt('Parameter in Effect').''); foreach (sort keys %name) { + $r->print(''); &print_row($r,$_,\%part,\%name,$mapid,\%default, - \%type,\%display,$defbgone,$defbgtwo,$parmlev); + \%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec); # $r->print("resource.$part{$_}.$name{$_},$symbp{$mapid}\n"); } $r->print(""); } # end of $parmlev eq general } $r->print('
'. - "$bighash{'title_'.$rid}"); + " TARGET=_self>$title"); if ($thistitle) { $r->print(' ('.$thistitle.')'); @@ -1167,7 +1333,7 @@ ENDTABLEHEADFOUR &print_row($r,$_,\%part,\%name,$rid,\%default, \%type,\%display,$defbgone,$defbgtwo, - $parmlev); + $parmlev,$uname,$udom,$csec); } } } @@ -1211,7 +1377,7 @@ ENDTABLEHEADFOUR # $r->print("$mapid:$map: $rid \n"); if ($map eq $mapid) { - my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); + my $uri=&Apache::lonnet::declutter($uris{$rid}); # $r->print("Keys: $keyp{$rid} \n"); #-------------------------------------------------------------------- @@ -1241,12 +1407,12 @@ ENDTABLEHEADFOUR } # end loop through ids #---------------------------------------------------- print header information - my $foldermap=($maptitle=~/^uploaded/?'Folder':'Map'); + my $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map'); my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':''); $r->print(< -Set Defaults for All Resources in $foldermap -$showtitle +Set Defaults for All Resources in $foldermap +$showtitle Specifically for ENDMAPONE if ($uname) { @@ -1254,25 +1420,28 @@ ENDMAPONE ('firstname','middlename','lastname','generation', 'id')); my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}; - $r->print("User $uname \($person\) in \n"); + $r->print(&mt("User")." $uname \($person\) ". + &mt('in')." \n"); } else { - $r->print("all users in \n"); + $r->print("".&mt('all').' '.&mt('users in')." \n"); } - if ($csec) {$r->print("Section $csec of \n")}; + if ($csec) {$r->print(&mt("Section")." $csec ". + &mt('of')." \n")}; - $r->print("$coursename"); - $r->print("\n"); + $r->print("$coursename"); + $r->print("\n"); #---------------------------------------------------------------- print table $r->print(''); - $r->print('Parameter Name'); - $r->print('Default Value'); - $r->print('Parameter in Effect'); + $r->print(''.&mt('Parameter Name').''); + $r->print(''.&mt('Default Value').''); + $r->print(''.&mt('Parameter in Effect').''); foreach (sort keys %name) { + $r->print(''); &print_row($r,$_,\%part,\%name,$mapid,\%default, \%type,\%display,$defbgone,$defbgtwo, - $parmlev); + $parmlev,$uname,$udom,$csec); # $r->print("resource.$part{$_}.$name{$_},$symbp{$mapid}\n"); } $r->print(""); @@ -1296,7 +1465,7 @@ ENDMAPONE foreach (@ids) { my $rid = $_; - my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); + my $uri=&Apache::lonnet::declutter($uris{$rid}); #-------------------------------------------------------------------- # @catmarker contains list of all possible parameters including part #s @@ -1323,40 +1492,39 @@ ENDMAPONE } # end loop through ids #---------------------------------------------------- print header information + my $setdef=&mt("Set Defaults for All Resources in Course"); $r->print(< -Set Defaults for All Resources in Course -$coursename +$setdef +$coursename ENDMAPONE if ($uname) { my %name=&Apache::lonnet::userenvironment($udom,$uname, ('firstname','middlename','lastname','generation', 'id')); my $person=$name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}; - $r->print(" User $uname \($person\) \n"); + $r->print(" ".&mt("User")." $uname \($person\) \n"); } else { - $r->print("ALL USERS \n"); + $r->print(" ".&mt("ALL")." ".&mt("USERS")." \n"); } - if ($csec) {$r->print("Section $csec\n")}; - $r->print("\n"); + if ($csec) {$r->print(&mt("Section")." $csec\n")}; + $r->print("\n"); #---------------------------------------------------------------- print table $r->print(''); - $r->print('Parameter Name'); - $r->print('Default Value'); - $r->print('Parameter in Effect'); + $r->print(''.&mt('Parameter Name').''); + $r->print(''.&mt('Default Value').''); + $r->print(''.&mt('Parameter in Effect').''); foreach (sort keys %name) { + $r->print(''); &print_row($r,$_,\%part,\%name,$mapid,\%default, - \%type,\%display,$defbgone,$defbgtwo,$parmlev); + \%type,\%display,$defbgone,$defbgtwo,$parmlev,$uname,$udom,$csec); # $r->print("resource.$part{$_}.$name{$_},$symbp{$mapid}\n"); } $r->print(""); } # end of $parmlev eq general } $r->print('