--- loncom/interface/lonparmset.pm 2003/06/23 21:42:07 1.109 +++ loncom/interface/lonparmset.pm 2005/06/02 16:35:32 1.200 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.109 2003/06/23 21:42:07 albertel Exp $ +# $Id: lonparmset.pm,v 1.200 2005/06/02 16:35:32 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,26 +61,27 @@ use Apache::loncommon; use GDBM_File; use Apache::lonhomework; use Apache::lonxml; +use Apache::lonlocal; +use Apache::lonnavmaps; +# --- Caches local to lonparmset -my %courseopt; -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; - ################################################## ################################################## @@ -96,10 +97,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 @@ -113,7 +114,17 @@ 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 $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); + my $courseopt=&Apache::lonnet::get_courseresdata($cnum,$cdom); + + my $result=''; my @outpar=(); # ----------------------------------------------------- Cascading lookup scheme @@ -121,77 +132,218 @@ 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 $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 $courselevel=$env{'request.course.id'}.'.'.$what; + my $courselevelr=$env{'request.course.id'}.'.'.$symbparm; + my $courselevelm=$env{'request.course.id'}.'.'.$mapparm; -# -------------------------------------------------------- first, check default - if ($def) { $outpar[11]=$def; $result=11; } -# ----------------------------------------------------- second, check map parms +# --------------------------------------------------------- first, check course - my $thisparm=$parmhash{$symbparm}; - if ($thisparm) { $outpar[10]=$thisparm; $result=10; } - -# --------------------------------------------------------- third, check course - - if (defined($courseopt{$courselevel})) { - $outpar[9]=$courseopt{$courselevel}; - $result=9; + if (defined($$courseopt{$courselevel})) { + $outpar[11]=$$courseopt{$courselevel}; + $result=11; } - if (defined($courseopt{$courselevelm})) { - $outpar[8]=$courseopt{$courselevelm}; - $result=8; + if (defined($$courseopt{$courselevelm})) { + $outpar[10]=$$courseopt{$courselevelm}; + $result=10; } - if (defined($courseopt{$courselevelr})) { - $outpar[7]=$courseopt{$courselevelr}; +# ------------------------------------------------------- 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}; + if (defined($$courseopt{$seclevel})) { + $outpar[6]=$$courseopt{$seclevel}; $result=6; } - if (defined($courseopt{$seclevelm})) { - $outpar[5]=$courseopt{$seclevelm}; + if (defined($$courseopt{$seclevelm})) { + $outpar[5]=$$courseopt{$seclevelm}; $result=5; } - if (defined($courseopt{$seclevelr})) { - $outpar[4]=$courseopt{$seclevelr}; + if (defined($$courseopt{$seclevelr})) { + $outpar[4]=$$courseopt +{$seclevelr}; $result=4; } } -# ---------------------------------------------------------- fourth, check user +# ---------------------------------------------------------- fifth, check user if (defined($uname)) { - if (defined($useropt{$courselevel})) { - $outpar[3]=$useropt{$courselevel}; + if (defined($$useropt{$courselevel})) { + $outpar[3]=$$useropt{$courselevel}; $result=3; } - if (defined($useropt{$courselevelm})) { - $outpar[2]=$useropt{$courselevelm}; + if (defined($$useropt{$courselevelm})) { + $outpar[2]=$$useropt{$courselevelm}; $result=2; } - if (defined($useropt{$courselevelr})) { - $outpar[1]=$useropt{$courselevelr}; + if (defined($$useropt{$courselevelr})) { + $outpar[1]=$$useropt{$courselevelr}; $result=1; } } 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'}; + } +} + +################################################## +################################################## +# +# 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 +# + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; +# 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)],$cdom,$cnum); + } else { + $reply=&Apache::lonnet::cput + ('resourcedata',\%storecontent,$cdom,$cnum); + } + &Apache::lonnet::devalidatecourseresdata($cnum,$cdom); + } 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 ''; +} + ################################################## ################################################## @@ -272,9 +424,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 @@ -285,16 +437,34 @@ sub plink { sub startpage { - my ($r,$id,$udom,$csec,$uname,$have_assesments)=@_; + my ($r,$id,$udom,$csec,$uname,$have_assesments,$trimheader)=@_; - my $bodytag=&Apache::loncommon::bodytag('Set Course Parameters','', + 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) { @@ -989,9 +1107,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'); } @@ -1028,9 +1146,9 @@ sub assessparms { } $r->print(''); if (($prevvisit) || ($pschp) || ($pssymb)) { - $submitmessage = "Update Course Assessment Parameter Display"; + $submitmessage = &mt("Update Course Assessment Parameter Display"); } else { - $submitmessage = "Set Course Assessment Parameters"; + $submitmessage = &mt("Set/Modify Course Assessment Parameters"); } $r->print(''); @@ -1052,40 +1170,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 FolderPartParameter 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(''); @@ -1098,18 +1235,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= (); @@ -1118,7 +1257,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 = $_; @@ -1136,15 +1275,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.')'); @@ -1172,7 +1312,7 @@ ENDTABLEHEADFOUR &print_row($r,$_,\%part,\%name,$rid,\%default, \%type,\%display,$defbgone,$defbgtwo, - $parmlev); + $parmlev,$uname,$udom,$csec); } } } @@ -1216,7 +1356,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"); #-------------------------------------------------------------------- @@ -1246,12 +1386,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) { @@ -1259,25 +1399,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(""); @@ -1301,7 +1444,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 @@ -1328,40 +1471,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.')'); @@ -1172,7 +1312,7 @@ ENDTABLEHEADFOUR &print_row($r,$_,\%part,\%name,$rid,\%default, \%type,\%display,$defbgone,$defbgtwo, - $parmlev); + $parmlev,$uname,$udom,$csec); } } } @@ -1216,7 +1356,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"); #-------------------------------------------------------------------- @@ -1246,12 +1386,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) { @@ -1259,25 +1399,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(""); @@ -1301,7 +1444,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 @@ -1328,40 +1471,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('