Sort list by ');
- $r->print('');
- $r->print('Enclosing Map ');
- foreach (reverse sort keys %allkeys) {
- $r->print('print(' selected'); }
- $r->print('>'.$allkeys{$_}.' ');
- }
+ $r->print(''.$message.' ');
+ 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) {
+# push(@temp_psprt, grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts));
+# }
+
+# @psprt = @temp_psprt;
+
+ my @temp_pscat;
+ map {
+ my $cat = $_;
+ push(@temp_pscat, map { $_.'.'.$cat } @psprt);
+ } @pscat;
+
+ @pscat = @temp_pscat;
+
+ if (($prevvisit) || ($pschp) || ($pssymb)) {
# ----------------------------------------------------------------- Start Table
- my $catmarker='parameter_'.$pscat;
- $catmarker=~s/\./\_/g;
- my $coursespan=$csec?8:5;
- my $csuname=$ENV{'user.name'};
- my $csudom=$ENV{'user.domain'};
- $r->print(<
-
-Any User
-ENDTABLEHEAD
- if ($uname) {
- $r->print("User $uname at Domain $udom ");
- }
- $r->print(<Parameter in Effect
-Current Session Value ($csuname at $csudom)
-
-Resource Level
-in Course
+ my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat;
+ 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(''.&mt('Any User').' ');
+ if ($uname) {
+ $r->print("");
+ $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(<$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(<Assessment URL and Title Type
-Enclosing Map Part No. Parameter Name
-default from Enclosing Map
-general for Enclosing Map for Resource
+ if ($csec) {
+ $r->print("".
+ &mt("in Section/Group")." $csec ");
+ }
+ $r->print(<$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('general for Enclosing Map for Resource ');
- }
- if ($uname) {
- $r->print('general for Enclosing Map for Resource ');
- }
- $r->print(' ');
- my $defbgone='';
- my $defbgtwo='';
- foreach (@ids) {
- my $rid=$_;
- my ($inmapid)=($rid=~/\.(\d+)$/);
- if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) ||
- ($pssymb eq $symbp{$rid})) {
+
+ if ($csec) {
+ $r->print(''.&mt('general').' '.&mt('for Enclosing Map or Folder').' '.&mt('for Resource').' ');
+ }
+
+ if ($uname) {
+ $r->print(''.&mt('general').' '.&mt('for Enclosing Map or Folder').' '.&mt('for Resource').' ');
+ }
+
+ $r->print(' ');
+
+ my $defbgone='';
+ my $defbgtwo='';
+
+ foreach (@ids) {
+
+ my $rid=$_;
+ my ($inmapid)=($rid=~/\.(\d+)$/);
+
+ 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"';
- } else {
- $defbgone='"E0E099"';
- }
- if ($defbgtwo eq '"FFFF99"') {
- $defbgtwo='"FFFFDD"';
- } else {
- $defbgtwo='"FFFF99"';
- }
- my $thistitle='';
- my %name= ();
- undef %name;
- my %part= ();
- my %display=();
- my %type= ();
- my %default=();
- my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid});
-
- foreach (split(/\,/,$keyp{$rid})) {
- if (($_ eq $catmarker) || ($pscat eq 'all')) {
- $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
- $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
- $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
- unless ($display{$_}) { $display{$_}=''; }
- $display{$_}.=' ('.$name{$_}.')';
- $default{$_}=&Apache::lonnet::metadata($uri,$_);
- $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
- $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
- }
- }
- my $totalparms=scalar keys %name;
- if ($totalparms>0) {
- my $firstrow=1;
- $r->print(''.
- join(' / ',split(/\//,$uri)).
- ' '.
- $bighash{'title_'.$rid});
- if ($thistitle) {
- $r->print(' ('.$thistitle.')');
- }
- $r->print('
');
- $r->print(''.$typep{$rid}.' ');
- $r->print(''.
- join(' / ',split(/\//,$mapp{$rid})).' ');
- foreach (sort keys %name) {
- unless ($firstrow) {
- $r->print('');
- } else {
- $firstrow=0;
- }
- &print_row($r,$_,\%part,\%name,$rid,\%default,
- \%type,\%display,$defbgone,$defbgtwo);
- }
- }
+ if ($defbgone eq '"#E0E099"') {
+ $defbgone='"#E0E0DD"';
+ } else {
+ $defbgone='"#E0E099"';
+ }
+ if ($defbgtwo eq '"#FFFF99"') {
+ $defbgtwo='"#FFFFDD"';
+ } else {
+ $defbgtwo='"#FFFF99"';
+ }
+ my $thistitle='';
+ my %name= ();
+ undef %name;
+ my %part= ();
+ my %display=();
+ my %type= ();
+ my %default=();
+ my $uri=&Apache::lonnet::declutter($uris{$rid});
+
+ foreach (split(/\,/,$keyp{$rid})) {
+ my $tempkeyp = $_;
+ if (grep $_ eq $tempkeyp, @catmarker) {
+ $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
+ $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
+ $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
+ unless ($display{$_}) { $display{$_}=''; }
+ $display{$_}.=' ('.$name{$_}.')';
+ $default{$_}=&Apache::lonnet::metadata($uri,$_);
+ $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
+ $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
+ }
+ }
+ my $totalparms=scalar keys %name;
+ if ($totalparms>0) {
+ my $firstrow=1;
+ my $title=&Apache::lonnet::gettitle($uri);
+ $r->print(' '.
+ join(' / ',split(/\//,$uri)).
+ ' '.
+ "$title");
+
+ if ($thistitle) {
+ $r->print(' ('.$thistitle.')');
+ }
+ $r->print('
');
+ $r->print(''.$typep{$rid}.
+ ' ');
+
+ $r->print('');
+
+ $r->print(' / res / ');
+ $r->print(join(' / ', split(/\//,$mapp{$rid})));
+
+ $r->print(' ');
+
+ foreach (sort keys %name) {
+ unless ($firstrow) {
+ $r->print('');
+ } else {
+ undef $firstrow;
+ }
+
+ &print_row($r,$_,\%part,\%name,$rid,\%default,
+ \%type,\%display,$defbgone,$defbgtwo,
+ $parmlev,$uname,$udom,$csec);
+ }
+ }
+ }
+ } # end foreach ids
# -------------------------------------------------- End entry for one resource
- }
- }
- $r->print('
');
+ $r->print('
');
+ } # end of brief/full
+#--------------------------------------------------- Entry for parm level map
+ if ($parmlev eq 'map') {
+ my $defbgone = '"E0E099"';
+ my $defbgtwo = '"FFFF99"';
+
+ my %maplist;
+
+ if ($pschp eq 'all') {
+ %maplist = %allmaps;
+ } else {
+ %maplist = ($pschp => $mapp{$pschp});
+ }
+
+#-------------------------------------------- for each map, gather information
+ my $mapid;
+ foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
+ my $maptitle = $maplist{$mapid};
+
+#----------------------- loop through ids and get all parameter types for map
+#----------------------------------------- and associated information
+ my %name = ();
+ my %part = ();
+ my %display = ();
+ my %type = ();
+ my %default = ();
+ my $map = 0;
+
+# $r->print("Catmarker: @catmarker \n");
+
+ foreach (@ids) {
+ ($map)=(/([\d]*?)\./);
+ my $rid = $_;
+
+# $r->print("$mapid:$map: $rid \n");
+
+ if ($map eq $mapid) {
+ my $uri=&Apache::lonnet::declutter($uris{$rid});
+# $r->print("Keys: $keyp{$rid} \n");
+
+#--------------------------------------------------------------------
+# @catmarker contains list of all possible parameters including part #s
+# $fullkeyp contains the full part/id # for the extraction of proper parameters
+# $tempkeyp contains part 0 only (no ids - ie, subparts)
+# When storing information, store as part 0
+# When requesting information, request from full part
+#-------------------------------------------------------------------
+ foreach (split(/\,/,$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');
+ $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ 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 $foldermap=&mt($maptitle=~/^uploaded/?'Folder':'Map');
+ my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');
+ $r->print(<
+Set Defaults for All Resources in $foldermap
+$showtitle
+Specifically for
+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(&mt("User")." $uname \($person\) ".
+ &mt('in')." \n");
+ } else {
+ $r->print("".&mt('all').' '.&mt('users in')." \n");
+ }
+
+ if ($csec) {$r->print(&mt("Section")." $csec ".
+ &mt('of')." \n")};
+
+ $r->print("$coursename ");
+ $r->print(" \n");
+#---------------------------------------------------------------- print table
+ $r->print('
');
+ $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,$uname,$udom,$csec);
+# $r->print(" resource.$part{$_}.$name{$_},$symbp{$mapid} \n");
+ }
+ $r->print("
");
+ } # end each map
+ } # end of $parmlev eq map
+#--------------------------------- Entry for parm level general (Course level)
+ if ($parmlev eq 'general') {
+ my $defbgone = '"E0E099"';
+ my $defbgtwo = '"FFFF99"';
+
+#-------------------------------------------- for each map, gather information
+ my $mapid="0.0";
+#----------------------- loop through ids and get all parameter types for map
+#----------------------------------------- and associated information
+ my %name = ();
+ my %part = ();
+ my %display = ();
+ my %type = ();
+ my %default = ();
+
+ foreach (@ids) {
+ my $rid = $_;
+
+ my $uri=&Apache::lonnet::declutter($uris{$rid});
+
+#--------------------------------------------------------------------
+# @catmarker contains list of all possible parameters including part #s
+# $fullkeyp contains the full part/id # for the extraction of proper parameters
+# $tempkeyp contains part 0 only (no ids - ie, subparts)
+# When storing information, store as part 0
+# When requesting information, request from full part
+#-------------------------------------------------------------------
+ foreach (split(/\,/,$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');
+ $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
+ 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");
+ $r->print(<$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(" ".&mt("User")." $uname \($person\) \n");
+ } else {
+ $r->print(" ".&mt("ALL")." ".&mt("USERS")." \n");
+ }
+
+ if ($csec) {$r->print(&mt("Section")." $csec \n")};
+ $r->print(" \n");
+#---------------------------------------------------------------- print table
+ $r->print('
');
+ $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,$uname,$udom,$csec);
+# $r->print(" resource.$part{$_}.$name{$_},$symbp{$mapid} \n");
+ }
+ $r->print("
");
+ } # end of $parmlev eq general
}
$r->print('