[LON-CAPA-cvs] cvs: loncom /interface lonparmset.pm
raeburn
raeburn at source.lon-capa.org
Thu Dec 11 21:12:18 EST 2014
raeburn Fri Dec 12 02:12:18 2014 EDT
Modified files:
/loncom/interface lonparmset.pm
Log:
- Coding style:
- reverse(), keys(), sort(), split()
- for readability eliminate use of $_
- standard indent is four spaces
-------------- next part --------------
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.547 loncom/interface/lonparmset.pm:1.548
--- loncom/interface/lonparmset.pm:1.547 Fri Sep 12 18:09:58 2014
+++ loncom/interface/lonparmset.pm Fri Dec 12 02:12:18 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.547 2014/09/12 18:09:58 raeburn Exp $
+# $Id: lonparmset.pm,v 1.548 2014/12/12 02:12:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1025,26 +1025,25 @@
my ($othergrp,$grp_parm,$controlgrp);
if ($parmlev eq 'general') {
-
if ($uname) {
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} elsif ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} elsif ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} else {
- &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
}
} elsif ($parmlev eq 'map') {
if ($uname) {
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} elsif ($cgroup) {
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} elsif ($csec) {
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
} else {
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
}
} else {
if ($uname) {
@@ -1064,33 +1063,32 @@
}
}
- &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
-
- &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
-
- if ($csec) {
- &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- }
+ &print_td($r,14,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,12,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,10,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+
+ if ($csec) {
+ &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,8,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,7,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ }
if ($cgroup) {
- &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
+ &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,4,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
}
- if ($uname) {
+ if ($uname) {
if ($othergrp) {
$r->print($othergrp);
}
- &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
- }
+ &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display);
+ }
} # end of $parmlev if/else
$r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>');
@@ -1498,9 +1496,7 @@
sub parmboxes {
my ($r,$allparms,$pscat,$keyorder)=@_;
- my $tempkey;
- my $tempparameter;
- my %categories = &categories;
+ my %categories = &categories();
my %category_order = &category_order();
my %categoryList = (
'time_settings' => [],
@@ -1515,7 +1511,7 @@
'misc' => [],
);
- foreach $tempparameter (keys %$allparms) {
+ foreach my $tempparameter (keys(%$allparms)) {
&whatIsMyCategory($tempparameter, \%categoryList);
}
#part to print the parm-list
@@ -1622,7 +1618,7 @@
$sections .= qq| onchange="group_or_section('csec')" |;
}
$sections .= '>';
- foreach my $section ('',sort keys %sectionhash) {
+ foreach my $section ('',sort(keys(%sectionhash))) {
$sections.='<option value="'.$section.'" '.
($section eq $csec?'selected="selected"':'').'>'.$section.
'</option>';
@@ -1667,7 +1663,7 @@
$groups .= qq| onchange="group_or_section('cgroup')" |;
}
$groups .= '>';
- foreach my $grp ('',sort keys %grouphash) {
+ foreach my $grp ('',sort(keys(%grouphash))) {
$groups.='<option value="'.$grp.'" ';
if ($grp eq $cgroup) {
unless ((defined($uname)) && ($grp eq '')) {
@@ -1873,14 +1869,15 @@
sub levelmenu {
my ($r,$alllevs,$parmlev)=@_;
- $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').&Apache::loncommon::help_open_topic('Course_Parameter_Levels')));
+ $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameter Level').
+ &Apache::loncommon::help_open_topic('Course_Parameter_Levels')));
$r->print('<select id="parmlev" name="parmlev" onchange="showHide_courseContent()">');
- foreach (reverse sort keys %{$alllevs}) {
- $r->print('<option value="'.$$alllevs{$_}.'"');
- if ($parmlev eq $$alllevs{$_}) {
- $r->print(' selected="selected"');
- }
- $r->print('>'.&mt($_).'</option>');
+ foreach my $lev (reverse(sort(keys(%{$alllevs})))) {
+ $r->print('<option value="'.$$alllevs{$lev}.'"');
+ if ($parmlev eq $$alllevs{$lev}) {
+ $r->print(' selected="selected"');
+ }
+ $r->print('>'.&mt($lev).'</option>');
}
$r->print("</select>");
}
@@ -1892,15 +1889,15 @@
return if (!%sectionhash);
$r->print('<select name="Section" multiple="multiple" size="8">');
- foreach my $s ('all',sort keys %sectionhash) {
- $r->print(' <option value="'.$s.'"');
- foreach (@{$selectedsections}) {
- if ($s eq $_) {
- $r->print(' selected="selected"');
- last;
+ foreach my $s ('all',sort(keys(%sectionhash))) {
+ $r->print(' <option value="'.$s.'"');
+ foreach my $sec (@{$selectedsections}) {
+ if ($s eq $sec) {
+ $r->print(' selected="selected"');
+ last;
+ }
}
- }
- $r->print('>'.$s."</option>\n");
+ $r->print('>'.$s."</option>\n");
}
$r->print("</select>\n");
}
@@ -1912,14 +1909,14 @@
$r->print('<select name="Group" multiple="multiple" size="8">');
foreach my $group (sort(keys(%grouphash))) {
- $r->print(' <option value="'.$group.'"');
- foreach (@{$selectedgroups}) {
- if ($group eq $_) {
- $r->print(' selected="selected"');
- last;
+ $r->print(' <option value="'.$group.'"');
+ foreach my $grp (@{$selectedgroups}) {
+ if ($group eq $grp) {
+ $r->print(' selected="selected"');
+ last;
+ }
}
- }
- $r->print('>'.$group."</option>\n");
+ $r->print('>'.$group."</option>\n");
}
$r->print("</select>\n");
}
@@ -1934,7 +1931,7 @@
my ($name,$keyorder)=@_;
return sort {
$$keyorder{$a} <=> $$keyorder{$b};
- } (keys %{$name});
+ } (keys(%{$name}));
}
sub keysinorder_bytype {
@@ -1946,14 +1943,14 @@
return ($a cmp $b);
}
$$keyorder{'parameter_0_'.$ta} <=> $$keyorder{'parameter_0_'.$tb};
- } (keys %{$name});
+ } (keys(%{$name}));
}
sub keysindisplayorder {
my ($name,$keyorder)=@_;
return sort {
$$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b};
- } (keys %{$name});
+ } (keys(%{$name}));
}
sub sortmenu {
@@ -2253,19 +2250,19 @@
}
}
#----------------------------------------------- if all selected, fill in array
- if ($pscat[0] eq "all") {@pscat = (keys %allparms);}
+ if ($pscat[0] eq "all") {@pscat = (keys(%allparms));}
if (!@pscat) { @pscat=('duedate','opendate','answerdate','weight','maxtries','type','problemstatus') };
- if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
+ if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys(%allparts));}
# ------------------------------------------------------------------ Start page
my $crstype = &Apache::loncommon::course_type();
&startpage($r,$pssymb,$crstype);
- foreach ('tolerance','date_default','date_start','date_end',
+ foreach my $item ('tolerance','date_default','date_start','date_end',
'date_interval','int','float','string') {
$r->print('<input type="hidden" value="'.
- &HTML::Entities::encode($env{'form.recent_'.$_},'"&<>').
- '" name="recent_'.$_.'" />');
+ &HTML::Entities::encode($env{'form.recent_'.$item},'"&<>').
+ '" name="recent_'.$item.'" />');
}
# ----- Start Parameter Selection
@@ -2372,6 +2369,7 @@
@pscat = @temp_pscat;
+
if (($env{'form.prevvisit'}) || ($pschp) || ($pssymb)) {
# ----------------------------------------------------------------- Start Table
my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat;
@@ -2497,35 +2495,34 @@
my $uri=&Apache::lonnet::declutter($uris{$rid});
my $filter=$env{'form.filter'};
- foreach (&keysplit($keyp{$rid})) {
- my $tempkeyp = $_;
+ foreach my $tempkeyp (&keysplit($keyp{$rid})) {
if (grep $_ eq $tempkeyp, @catmarker) {
- my $parmname=&Apache::lonnet::metadata($uri,$_.'.name');
+ my $parmname=&Apache::lonnet::metadata($uri,$tempkeyp.'.name');
# We may only want certain parameters listed
if ($filter) {
unless ($filter=~/\Q$parmname\E/) { next; }
}
- $name{$_}=$parmname;
- $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
+ $name{$tempkeyp}=$parmname;
+ $part{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.part');
- my $parmdis=&Apache::lonnet::metadata($uri,$_.'.display');
- if ($allparms{$name{$_}} ne '') {
+ my $parmdis=&Apache::lonnet::metadata($uri,$tempkeyp.'.display');
+ if ($allparms{$name{$tempkeyp}} ne '') {
my $identifier;
if ($parmdis =~ /(\s*\[Part.*)$/) {
$identifier = $1;
}
- $display{$_} = $allparms{$name{$_}}.$identifier;
+ $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
} else {
- $display{$_} = $parmdis;
+ $display{$tempkeyp} = $parmdis;
}
- unless ($display{$_}) { $display{$_}=''; }
- $display{$_}.=' ('.$name{$_}.')';
- $default{$_}=&Apache::lonnet::metadata($uri,$_);
- $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
- $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
+ unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
+ $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
+ $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp);
+ $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$tempkeyp.'.type');
+ $thistitle=&Apache::lonnet::metadata($uri,$tempkeyp.'.title');
}
}
- my $totalparms=scalar keys %name;
+ my $totalparms=scalar(keys(%name));
if ($totalparms>0) {
my $firstrow=1;
my $title=&Apache::lonnet::gettitle($symbp{$rid});
@@ -2551,14 +2548,13 @@
$r->print('<td style="background-color:'.$defbgone.';"'.
' rowspan='.$totalparms.
'>'.$maptitles{$mapp{$rid}}.'</td>');
- foreach (&keysinorder_bytype(\%name,\%keyorder)) {
-
+ foreach my $item (&keysinorder_bytype(\%name,\%keyorder)) {
unless ($firstrow) {
$r->print('<tr>');
} else {
undef $firstrow;
}
- &print_row($r,$_,\%part,\%name,\%symbp,$rid,\%default,
+ &print_row($r,$item,\%part,\%name,\%symbp,$rid,\%default,
\%type,\%display,$defbgone,$defbgtwo,
$defbgthree,$parmlev,$uname,$udom,$csec,
$cgroup,\@usersgroups);
@@ -2585,7 +2581,7 @@
#-------------------------------------------- for each map, gather information
my $mapid;
- foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
+ foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys(%maplist)) {
my $maptitle = $maplist{$mapid};
#----------------------- loop through ids and get all parameter types for map
@@ -2599,9 +2595,9 @@
# $r->print("Catmarker: @catmarker<br />\n");
- foreach (@ids) {
- ($map)=(/([\d]*?)\./);
- my $rid = $_;
+ foreach my $id (@ids) {
+ ($map)=($id =~ /([\d]*?)\./);
+ my $rid = $id;
# $r->print("$mapid:$map: $rid <br /> \n");
@@ -2616,12 +2612,11 @@
# 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_/;
+ foreach my $fullkeyp (&keysplit($keyp{$rid})) {
+ my $tempkeyp = $fullkeyp;
+ $tempkeyp =~ s/_\w+_/_0_/;
- if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
+ 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');
@@ -2680,9 +2675,9 @@
.&Apache::loncommon::end_data_table_header_row()
);
- foreach (&keysinorder(\%name,\%keyorder)) {
+ foreach my $item (&keysinorder(\%name,\%keyorder)) {
$r->print(&Apache::loncommon::start_data_table_row());
- &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
+ &print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,$defbgthree,
$parmlev,$uname,$udom,$csec,$cgroup);
}
@@ -2707,8 +2702,8 @@
my %type = ();
my %default = ();
- foreach (@ids) {
- my $rid = $_;
+ foreach $id (@ids) {
+ my $rid = $id;
my $uri=&Apache::lonnet::declutter($uris{$rid});
@@ -2719,11 +2714,10 @@
# 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})) {
+ foreach my $fullkeyp (&keysplit($keyp{$rid})) {
+ my $tempkeyp = $fullkeyp;
+ $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');
@@ -2771,9 +2765,9 @@
.&Apache::loncommon::end_data_table_header_row()
);
- foreach (&keysinorder(\%name,\%keyorder)) {
+ foreach my $item (&keysinorder(\%name,\%keyorder)) {
$r->print(&Apache::loncommon::start_data_table_row());
- &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
+ &print_row($r,$item,\%part,\%name,\%symbp,$mapid,\%default,
\%type,\%display,$defbgone,$defbgtwo,$defbgthree,
$parmlev,$uname,$udom,$csec,$cgroup);
}
@@ -2819,19 +2813,19 @@
# Read userdata
my $classlist=&Apache::loncoursedata::get_classlist();
- foreach (keys %$classlist) {
- if ($_=~/^($match_username)\:($match_domain)$/) {
- my ($tuname,$tudom)=($1,$2);
- my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom);
- foreach my $userkey (keys %{$useropt}) {
- if ($userkey=~/^$env{'request.course.id'}/) {
+ foreach my $user (keys(%$classlist)) {
+ if ($user=~/^($match_username)\:($match_domain)$/) {
+ my ($tuname,$tudom)=($1,$2);
+ my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom);
+ foreach my $userkey (keys(%{$useropt})) {
+ if ($userkey=~/^\Q$env{'request.course.id'}\E/) {
my $newkey=$userkey;
- $newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./;
- $$resourcedata{$newkey}=$$useropt{$userkey};
- }
+ $newkey=~s/^($env{'request.course.id'}\.)/$1\[useropt\:$tuname\:$tudom\]\./;
+ $$resourcedata{$newkey}=$$useropt{$userkey};
+ }
+ }
}
}
- }
return $resourcedata;
}
@@ -2960,7 +2954,7 @@
}
# Store all course level
my $delentries=$#deldata+1;
- my @newdatakeys=keys %newdata;
+ my @newdatakeys=keys(%newdata);
my $putentries=$#newdatakeys+1;
if ($delentries) {
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') {
@@ -3061,7 +3055,7 @@
}
$result;
- } keys %{$listdata}) {
+ } keys(%{$listdata})) {
if ($$listdata{$thiskey.'.type'}) {
my $thistype=$$listdata{$thiskey.'.type'};
@@ -3328,7 +3322,7 @@
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
my %data=&Apache::lonnet::dump('resourcedata',$dom,$crs);
# ugly retro fix for broken version of types
- foreach my $key (keys %data) {
+ foreach my $key (keys(%data)) {
if ($key=~/\wtype$/) {
my $newkey=$key;
$newkey=~s/type$/\.type/;
@@ -3338,7 +3332,7 @@
}
my %storecontent=();
# go through all parameters and look for dates
- foreach my $key (keys %data) {
+ foreach my $key (keys(%data)) {
if ($data{$key.'.type'}=~/^date_(start|end)$/) {
my $newdate=$data{$key}+$shift;
$storecontent{$key}=$newdate;
@@ -3523,7 +3517,7 @@
$$listdata{$newparmkey.'.type'}=$$defkeytype{$cat};
} elsif ($parmlev eq 'map') {
# map-level parameter
- foreach my $mapid (keys %{$allmaps}) {
+ foreach my $mapid (keys(%{$allmaps})) {
if (($pschp ne 'all') && ($pschp ne $mapid)) { next; }
my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat;
$$listdata{$newparmkey}=1;
@@ -3943,7 +3937,7 @@
my $newpos = $env{'form.newpos'} - 1;
my $currentpos = $env{'form.currentpos'} - 1;
my @neworder = ();
- my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
+ my @oldorder = split(/,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'});
my $i;
if ($newpos > $currentpos) {
# moving stuff up
@@ -3977,10 +3971,10 @@
}
my $fields = &get_added_meta_fieldnames($env{'request.course.id'});
my $ordered_fields;
- my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'};
+ my @fields_in_order = split(/,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'});
if (!@fields_in_order) {
# no order found, pick sorted order then create metadata.addedorder key.
- foreach my $key (sort keys %$fields) {
+ foreach my $key (sort(keys(%$fields))) {
push @fields_in_order, $key;
$ordered_fields = join ",", @fields_in_order;
}
@@ -4261,7 +4255,7 @@
}
}
}
- foreach my $key (keys %allparms) {
+ foreach my $key (keys(%allparms)) {
$newrules{$key.'_triggers'}=$triggers{$key};
}
&Apache::lonnet::put('parmdefactions',\%newrules,$cdom,$cnum);
More information about the LON-CAPA-cvs
mailing list