version 1.69, 2015/03/07 23:17:15
|
version 1.70, 2015/04/28 13:20:41
|
Line 2325 sub display_loncaparev_constraints {
|
Line 2325 sub display_loncaparev_constraints {
|
my $resourcedata = &Apache::lonparmset::readdata($cnum,$cdom); |
my $resourcedata = &Apache::lonparmset::readdata($cnum,$cdom); |
if (ref($resourcedata) eq 'HASH') { |
if (ref($resourcedata) eq 'HASH') { |
foreach my $key (keys(%{$resourcedata})) { |
foreach my $key (keys(%{$resourcedata})) { |
|
my %found; |
foreach my $item (keys(%Apache::lonrelrequtils::checkparms)) { |
foreach my $item (keys(%Apache::lonrelrequtils::checkparms)) { |
if ($key =~ /(\Q$item\E)$/) { |
if ($key =~ /(\Q$item\E)$/) { |
if (ref($Apache::lonrelrequtils::checkparms{$item}) eq 'ARRAY') { |
if (ref($Apache::lonrelrequtils::checkparms{$item}) eq 'ARRAY') { |
my $value = $resourcedata->{$key}; |
my $value = $resourcedata->{$key}; |
if ($item eq 'examcode') { |
if ($item eq 'examcode') { |
if (&Apache::lonnet::validCODE($value)) { |
if (&Apache::lonnet::validCODE($value)) { |
$value = 'valid'; |
$value = 'valid'; |
} else { |
} else { |
$value = ''; |
$value = ''; |
} |
} |
} elsif ($item eq 'printstartdate') { |
} elsif ($item eq 'printstartdate') { |
if ($value =~ /^\d+$/) { |
if ($value =~ /^\d+$/) { |
if ($value > $now) { |
if ($value > $now) { |
$value = 'future'; |
$value = 'future'; |
} |
} |
} |
} |
} elsif ($item eq 'printenddate') { |
} elsif ($item eq 'printenddate') { |
if ($value =~ /^\d+$/) { |
if ($value =~ /^\d+$/) { |
if ($value < $now) { |
if ($value < $now) { |
$value = 'past'; |
$value = 'past'; |
} |
} |
} |
} |
} |
} |
my ($middle,$scope,$which,$level,$map,$resource); |
if (grep(/^\Q$value\E$/,@{$Apache::lonrelrequtils::checkparms{$item}})) { |
if (grep(/^\Q$value\E$/,@{$Apache::lonrelrequtils::checkparms{$item}})) { |
my $stdtype = &Apache::lonparmset::standard_parameter_types($item); |
my $stdtype = &Apache::lonparmset::standard_parameter_types($item); |
$found{$item}{'valname'} = &get_param_description($stdtype,$value); |
my $stdname = &Apache::lonparmset::standard_parameter_names($item); |
$found{$item}{'rev'} = $Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value.':'}; |
my $valname = &get_param_description($stdtype,$value); |
} |
my $rev = $Apache::lonnet::needsrelease{'parameter:'.$item.':'.$value}; |
} |
my $start = $cid.'.'; |
} |
if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) { |
} |
$middle = $1; |
foreach my $item (keys(%Apache::lonrelrequtils::checkparmsmatch)) { |
$which = $2; |
if (ref($Apache::lonrelrequtils::checkparmsmatch{$item}) eq 'ARRAY') { |
$scope = 'user'; |
my $value = $resourcedata->{$key}; |
} elsif ($key =~ /^\Q$start\E(\[(\w+)\]\.)/) { |
foreach my $valuematch (@{$Apache::lonrelrequtils::checkparmsmatch{$item}}) { |
$middle = $1; |
if ($value =~ /$valuematch/) { |
$which = $2; |
my $stdtype = &Apache::lonparmset::standard_parameter_types($item); |
$scope = 'section/group'; |
$found{$item}{'valname'} = &get_param_description($stdtype,$value,1); |
} else { |
$found{$item}{'rev'} = |
$scope = 'all'; |
$Apache::lonnet::needsrelease{'parameter:'.$item.'::'.$valuematch}; |
} |
last; |
my $what="$stdname=$valname"; |
} |
if ($key =~ /^\Q$start$middle\E\w+\.\Q$item\E$/) { |
} |
$level = 'general'; |
} |
if ($scope eq 'all') { |
} |
if (ref($fromparam{$rev}{$scope}) eq 'ARRAY') { |
foreach my $item (keys(%found)) { |
unless(grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}})) { |
my $stdname = &Apache::lonparmset::standard_parameter_names($item); |
push(@{$fromparam{$rev}{$scope}},$what); |
my $rev = $found{$item}{'rev'}; |
} |
my $valname = $found{$item}{'valname'}; |
} else { |
my ($middle,$scope,$which,$level,$map,$resource); |
push(@{$fromparam{$rev}{$scope}},$what); |
my $start = $cid.'.'; |
} |
if ($key =~ /^\Q$start\E(\[useropt\:($match_username\:$match_domain)\]\.)/) { |
} else { |
$middle = $1; |
if (ref($fromparam{$rev}{$scope}{$which}) eq 'ARRAY') { |
$which = $2; |
unless (grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}{$which}})) { |
$scope = 'user'; |
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
} elsif ($key =~ /^\Q$start\E(\[(\w+)\]\.)/) { |
} |
$middle = $1; |
} else { |
$which = $2; |
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
$scope = 'section/group'; |
} |
} else { |
} |
$scope = 'all'; |
$rowspan{$rev} ++; |
} |
} elsif ($key =~ /^\Q$start$middle\E(.+)___\(all\).\w+\.\Q$item\E$/) { |
my $what="$stdname=$valname"; |
$level = 'folder'; |
if ($key =~ /^\Q$start$middle\E\w+\.\Q$item\E$/) { |
$map = $1; |
$level = 'general'; |
if ($scope eq 'all') { |
if ($scope eq 'all') { |
if (ref($bymap{$map}{$rev}{$scope}) eq 'ARRAY') { |
if (ref($fromparam{$rev}{$scope}) eq 'ARRAY') { |
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}})) { |
unless(grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}})) { |
push(@{$bymap{$map}{$rev}{$scope}},$what); |
push(@{$fromparam{$rev}{$scope}},$what); |
} |
} |
} else { |
} else { |
push(@{$bymap{$map}{$rev}{$scope}},$what); |
push(@{$fromparam{$rev}{$scope}},$what); |
} |
} |
} else { |
} else { |
if (ref($bymap{$map}{$rev}{$scope}{$which}) eq 'ARRAY') { |
if (ref($fromparam{$rev}{$scope}{$which}) eq 'ARRAY') { |
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}{$which}})) { |
unless (grep(/^\Q$what\E$/,@{$fromparam{$rev}{$scope}{$which}})) { |
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
} |
} |
} else { |
} else { |
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
push(@{$fromparam{$rev}{$scope}{$which}},$what); |
} |
} |
} |
} |
} elsif ($key =~ /^\Q$start$middle\E(.+)\.\w+\.\Q$item\E$/) { |
$rowspan{$rev} ++; |
$level = 'resource'; |
} elsif ($key =~ /^\Q$start$middle\E(.+)___\(all\).\w+\.\Q$item\E$/) { |
$resource = $1; |
$level = 'folder'; |
if ($scope eq 'all') { |
$map = $1; |
if (ref($byresource{$resource}{$rev}{$scope}) eq 'ARRAY') { |
if ($scope eq 'all') { |
unless(grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}})) { |
if (ref($bymap{$map}{$rev}{$scope}) eq 'ARRAY') { |
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}})) { |
} |
push(@{$bymap{$map}{$rev}{$scope}},$what); |
} else { |
} |
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
} else { |
} |
push(@{$bymap{$map}{$rev}{$scope}},$what); |
} else { |
} |
if (ref($byresource{$resource}{$rev}{$scope}{$which}) eq 'ARRAY') { |
} else { |
unless (grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}{$which}})) { |
if (ref($bymap{$map}{$rev}{$scope}{$which}) eq 'ARRAY') { |
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
unless(grep(/^\Q$what\E$/,@{$bymap{$map}{$rev}{$scope}{$which}})) { |
} |
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
} else { |
} |
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
} else { |
} |
push(@{$bymap{$map}{$rev}{$scope}{$which}},$what); |
} |
} |
} |
} |
|
} elsif ($key =~ /^\Q$start$middle\E(.+)\.\w+\.\Q$item\E$/) { |
|
$level = 'resource'; |
|
$resource = $1; |
|
if ($scope eq 'all') { |
|
if (ref($byresource{$resource}{$rev}{$scope}) eq 'ARRAY') { |
|
unless(grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}})) { |
|
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
|
} |
|
} else { |
|
push(@{$byresource{$resource}{$rev}{$scope}},$what); |
|
} |
|
} else { |
|
if (ref($byresource{$resource}{$rev}{$scope}{$which}) eq 'ARRAY') { |
|
unless (grep(/^\Q$what\E$/,@{$byresource{$resource}{$rev}{$scope}{$which}})) { |
|
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
|
} |
|
} else { |
|
push(@{$byresource{$resource}{$rev}{$scope}{$which}},$what); |
} |
} |
} |
} |
} |
} |
Line 2851 sub releases_by_map {
|
Line 2870 sub releases_by_map {
|
} |
} |
|
|
sub get_param_description { |
sub get_param_description { |
my ($stdtype,$value) = @_; |
my ($stdtype,$value,$regexp) = @_; |
my $name = $value; |
my ($name,$parammatches,$paramstrings,@possibles); |
my $paramstrings = &Apache::lonparmset::standard_string_options($stdtype); |
$paramstrings = &Apache::lonparmset::standard_string_options($stdtype); |
unless (ref($paramstrings) eq 'ARRAY') { |
if ($regexp) { |
return $name; |
$parammatches = &Apache::lonparmset::standard_string_matches($stdtype); |
|
if (ref($parammatches) eq 'ARRAY') { |
|
@possibles = @{$parammatches}; |
|
} else { |
|
undef($regexp); |
|
$name = $value; |
|
} |
|
} |
|
unless ($regexp) { |
|
$name = $value; |
|
if (ref($paramstrings) eq 'ARRAY') { |
|
@possibles = @{$paramstrings}; |
|
} else { |
|
return $name; |
|
} |
} |
} |
foreach my $possibilities (@{$paramstrings}) { |
foreach my $possibilities (@possibles) { |
next unless (ref($possibilities) eq 'ARRAY'); |
next unless (ref($possibilities) eq 'ARRAY'); |
my ($thing, $description) = @{ $possibilities }; |
my $gotregexmatch = ''; |
if ($thing eq $value) { |
if ($regexp) { |
$name = $description; |
last if ($gotregexmatch); |
last; |
my ($item,$pattern) = @{ $possibilities }; |
|
if ($value =~ /$pattern/) { |
|
if (ref($paramstrings) eq 'ARRAY') { |
|
foreach my $possibles (@{$paramstrings}) { |
|
next unless (ref($possibles) eq 'ARRAY'); |
|
my ($thing,$description) = @{$possibles}; |
|
if ($thing eq $item) { |
|
$name = $description; |
|
$gotregexmatch = 1; |
|
last; |
|
} |
|
} |
|
last if ($gotregexmatch); |
|
} |
|
} |
|
} else { |
|
my ($thing,$description) = @{ $possibilities }; |
|
if ($thing eq $value) { |
|
$name = $description; |
|
last; |
|
} |
} |
} |
} |
} |
return $name; |
return $name; |