| |
@@ -825,7 +825,7 @@ sub print_advanced_search_form{
&Apache::lonhtmlcommon::breadcrumbs(undef,'Searching',
'Search_Advanced',
undef,undef,
- $ENV{'form.catalogmode'} ne 'groupsearch');
+ $env{'form.catalogmode'} ne 'groupsearch');
my %lt=&Apache::lonlocal::texthash('srch' => 'Search',
'reset' => 'Reset',
'help' => 'Help');
@@ -866,12 +866,12 @@ ENDHEADER
'keywords','notes','abstract','standards','mime') {
$scrout.=''.&titlefield($fields{$field}).' | '.
&Apache::lonmeta::prettyinput($field,
- $ENV{'form.'.$field},
+ $env{'form.'.$field},
$field,
'advsearch',
$related_word_search{$field},
' | ',
- $ENV{'form.'.$field.'_related'},
+ $env{'form.'.$field.'_related'},
50);
if ($related_word_search{$field}) {
$scrout .= 'related words';
@@ -885,7 +885,7 @@ ENDHEADER
' | '.&titlefield($fields{$field}).' | '.
''.
&Apache::lonmeta::prettyinput($field,
- $ENV{'form.'.$field},
+ $env{'form.'.$field},
$field,
'advsearch',
0).
@@ -894,19 +894,19 @@ ENDHEADER
$scrout.=' |
'.
&titlefield(&mt('MIME Type Category')).' | '.
&Apache::loncommon::filecategoryselect('category',
- $ENV{'form.category'}).
+ $env{'form.category'}).
' |
'.$/;
$scrout.=''.
&titlefield(&mt('Domains')).' | '.
&Apache::loncommon::domain_select('domains',
- $ENV{'form.domains'},1).
+ $env{'form.domains'},1).
' |
'.$/;
#
# Misc metadata
$scrout.=''.
&titlefield(&mt('Copyright/Distribution')).' | '.
&Apache::lonmeta::selectbox('copyright',
- $ENV{'form.copyright'},
+ $env{'form.copyright'},
\&Apache::loncommon::copyrightdescription,
( undef,
&Apache::loncommon::copyrightids)
@@ -914,7 +914,7 @@ ENDHEADER
$scrout.=' |
'.
&titlefield(&mt('Language')).' | '.
&Apache::lonmeta::selectbox('language',
- $ENV{'form.language'},
+ $env{'form.language'},
\&Apache::loncommon::languagedescription,
('any',&Apache::loncommon::languageids)
).' |
';
@@ -1096,16 +1096,16 @@ Outputs: text for box with view options
######################################################################
sub viewoptions {
my $scrout;
- if (! defined($ENV{'form.viewselect'})) {
- $ENV{'form.viewselect'}='detailed';
+ if (! defined($env{'form.viewselect'})) {
+ $env{'form.viewselect'}='detailed';
}
$scrout.=&Apache::lonmeta::selectbox('viewselect',
- $ENV{'form.viewselect'},
+ $env{'form.viewselect'},
\&viewoptiontext,
sort(keys(%Views)));
$scrout.= ' ';
my $countselect = &Apache::lonmeta::selectbox('show',
- $ENV{'form.show'},
+ $env{'form.show'},
undef,
(10,20,50,100,1000,10000));
$scrout .= (' 'x2).&mt('[_1] Records per Page',$countselect).
@@ -1145,7 +1145,7 @@ Outputs: returns undef on database error
This function is the reverse of &make_persistent() for form data.
Retrieve persistent data from %persistent_db. Retrieved items will have their
-values unescaped. If a form value already exists in $ENV, it will not be
+values unescaped. If a form value already exists in $env, it will not be
overwritten. Form values that are array references may have values appended
to them.
@@ -1167,20 +1167,20 @@ sub get_persistent_form_data {
next if ($name !~ /^form./);
# Kludgification begins!
if ($name eq 'form.domains' &&
- $ENV{'form.searchmode'} eq 'basic' &&
- $ENV{'form.phase'} ne 'disp_basic') {
+ $env{'form.searchmode'} eq 'basic' &&
+ $env{'form.phase'} ne 'disp_basic') {
next;
}
# End kludge (hopefully)
- next if (exists($ENV{$name}));
+ next if (exists($env{$name}));
my @values = map {
&Apache::lonnet::unescape($_);
} split(',',$persistent_db{$name});
next if (@values <1);
if ($arrays_allowed{$name}) {
- $ENV{$name} = [@values];
+ $env{$name} = [@values];
} else {
- $ENV{$name} = $values[0] if ($values[0]);
+ $env{$name} = $values[0] if ($values[0]);
}
}
untie (%persistent_db);
@@ -1285,9 +1285,9 @@ sub make_form_data_persistent {
my $r = shift;
my $filename = shift;
my %save;
- foreach (keys(%ENV)) {
+ foreach (keys(%env)) {
next if (!/^form/ || /submit/);
- $save{$_} = $ENV{$_};
+ $save{$_} = $env{$_};
}
return &make_persistent(\%save,$filename);
}
@@ -1335,36 +1335,36 @@ sub parse_advanced_search {
'lastrevisiondatestart_month','lastrevisiondatestart_day',
'lastrevisiondatestart_year','lastrevisiondateend_month',
'lastrevisiondateend_day','lastrevisiondateend_year') {
- $ENV{'form.'.$field}=~s/[^\w\/\s\(\)\=\-\"\']//g;
+ $env{'form.'.$field}=~s/[^\w\/\s\(\)\=\-\"\']//g;
}
foreach ('mode','form','element') {
# is this required? Hmmm.
- next if (! exists($ENV{'form.'.$_}));
- $ENV{'form.'.$_}=&Apache::lonnet::unescape($ENV{'form.'.$_});
- $ENV{'form.'.$_}=~s/[^\w\/\s\(\)\=\-\"\']//g;
+ next if (! exists($env{'form.'.$_}));
+ $env{'form.'.$_}=&Apache::lonnet::unescape($env{'form.'.$_});
+ $env{'form.'.$_}=~s/[^\w\/\s\(\)\=\-\"\']//g;
}
# Preprocess the category form element.
- $ENV{'form.category'} = 'any' if (! defined($ENV{'form.category'}) ||
- ref($ENV{'form.category'}));
+ $env{'form.category'} = 'any' if (! defined($env{'form.category'}) ||
+ ref($env{'form.category'}));
#
# Check to see if enough information was filled in
foreach my $field (@BasicFields) {
- if (&filled($ENV{'form.'.$field})) {
+ if (&filled($env{'form.'.$field})) {
$fillflag++;
}
}
foreach my $field (@StatsFields,@EvalFields) {
- if (&filled($ENV{'form.'.$field.'_max'})) {
+ if (&filled($env{'form.'.$field.'_max'})) {
$fillflag++;
}
- if (&filled($ENV{'form.'.$field.'_min'})) {
+ if (&filled($env{'form.'.$field.'_min'})) {
$fillflag++;
}
}
for my $field ('lowestgradelevel','highestgradelevel') {
- if ( $ENV{'form.'.$field} =~ /^\d+$/ &&
- $ENV{'form.'.$field} > 0) {
+ if ( $env{'form.'.$field} =~ /^\d+$/ &&
+ $env{'form.'.$field} > 0) {
$fillflag++;
}
}
@@ -1379,21 +1379,21 @@ sub parse_advanced_search {
my $font = '';
# Evaluate logical expression AND/OR/NOT phrase fields.
foreach my $field (@BasicFields) {
- next if (!defined($ENV{'form.'.$field}) || $ENV{'form.'.$field} eq '');
+ next if (!defined($env{'form.'.$field}) || $env{'form.'.$field} eq '');
my ($error,$SQLQuery) =
- &process_phrase_input($ENV{'form.'.$field},
- $ENV{'form.'.$field.'_related'},$field);
+ &process_phrase_input($env{'form.'.$field},
+ $env{'form.'.$field.'_related'},$field);
if (defined($error)) {
&output_unparsed_phrase_error($r,$closebutton,'phase=disp_adv',
$hidden_fields,$field);
return;
} else {
$pretty_search_string .=
- $font.$field.': '.$ENV{'form.'.$field};
- if ($ENV{'form.'.$field.'_related'}) {
+ $font.$field.': '.$env{'form.'.$field};
+ if ($env{'form.'.$field.'_related'}) {
my @Words =
&Apache::loncommon::get_related_words
- ($ENV{'form.'.$field});
+ ($env{'form.'.$field});
if (@Words) {
$pretty_search_string.= ' with related words: '.
join(', ',@Words[0..4]);
@@ -1409,11 +1409,11 @@ sub parse_advanced_search {
# Make the 'mime' from 'form.category' and 'form.extension'
#
my $searchphrase;
- if (exists($ENV{'form.category'}) &&
- $ENV{'form.category'} !~ /^\s*$/ &&
- $ENV{'form.category'} ne 'any') {
+ if (exists($env{'form.category'}) &&
+ $env{'form.category'} !~ /^\s*$/ &&
+ $env{'form.category'} ne 'any') {
my @extensions = &Apache::loncommon::filecategorytypes
- ($ENV{'form.category'});
+ ($env{'form.category'});
if (scalar(@extensions) > 0) {
$searchphrase = join(' OR ',@extensions);
}
@@ -1426,45 +1426,45 @@ sub parse_advanced_search {
}
#
# Evaluate option lists
- if ($ENV{'form.lowestgradelevel'} &&
- $ENV{'form.lowestgradelevel'} ne '0' &&
- $ENV{'form.lowestgradelevel'} =~ /^\d+$/) {
+ if ($env{'form.lowestgradelevel'} &&
+ $env{'form.lowestgradelevel'} ne '0' &&
+ $env{'form.lowestgradelevel'} =~ /^\d+$/) {
push(@queries,
- '(lowestgradelevel>='.$ENV{'form.lowestgradelevel'}.')');
+ '(lowestgradelevel>='.$env{'form.lowestgradelevel'}.')');
$pretty_search_string.="lowestgradelevel>=".
- $ENV{'form.lowestgradelevel'}."
\n";
+ $env{'form.lowestgradelevel'}."
\n";
}
- if ($ENV{'form.highestgradelevel'} &&
- $ENV{'form.highestgradelevel'} ne '0' &&
- $ENV{'form.highestgradelevel'} =~ /^\d+$/) {
+ if ($env{'form.highestgradelevel'} &&
+ $env{'form.highestgradelevel'} ne '0' &&
+ $env{'form.highestgradelevel'} =~ /^\d+$/) {
push(@queries,
- '(highestgradelevel<='.$ENV{'form.highestgradelevel'}.')');
+ '(highestgradelevel<='.$env{'form.highestgradelevel'}.')');
$pretty_search_string.="highestgradelevel<=".
- $ENV{'form.highestgradelevel'}."
\n";
+ $env{'form.highestgradelevel'}."
\n";
}
- if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') {
- push @queries,"(language like \"$ENV{'form.language'}\")";
+ if ($env{'form.language'} and $env{'form.language'} ne 'any') {
+ push @queries,"(language like \"$env{'form.language'}\")";
$pretty_search_string.=$font."language= ".
- &Apache::loncommon::languagedescription($ENV{'form.language'}).
+ &Apache::loncommon::languagedescription($env{'form.language'}).
"
\n";
}
- if ($ENV{'form.copyright'} and $ENV{'form.copyright'} ne 'any') {
- push @queries,"(copyright like \"$ENV{'form.copyright'}\")";
+ if ($env{'form.copyright'} and $env{'form.copyright'} ne 'any') {
+ push @queries,"(copyright like \"$env{'form.copyright'}\")";
$pretty_search_string.=$font."copyright = ".
- &Apache::loncommon::copyrightdescription($ENV{'form.copyright'}).
+ &Apache::loncommon::copyrightdescription($env{'form.copyright'}).
"
\n";
}
#
# Statistics
foreach my $field (@StatsFields,@EvalFields) {
my ($min,$max);
- if (exists($ENV{'form.'.$field.'_min'}) &&
- $ENV{'form.'.$field.'_min'} ne '') {
- $min = $ENV{'form.'.$field.'_min'};
- }
- if (exists($ENV{'form.'.$field.'_max'}) &&
- $ENV{'form.'.$field.'_max'} ne '') {
- $max = $ENV{'form.'.$field.'_max'};
+ if (exists($env{'form.'.$field.'_min'}) &&
+ $env{'form.'.$field.'_min'} ne '') {
+ $min = $env{'form.'.$field.'_min'};
+ }
+ if (exists($env{'form.'.$field.'_max'}) &&
+ $env{'form.'.$field.'_max'} ne '') {
+ $max = $env{'form.'.$field.'_max'};
}
next if (! defined($max) && ! defined($min));
if (defined($min) && defined($max)) {
@@ -1517,17 +1517,17 @@ sub parse_advanced_search {
## because I was unable to figureout exactly how it worked and could
## not imagine people actually using it. MH
##
- # if ($ENV{'form.custommetadata'}) {
+ # if ($env{'form.custommetadata'}) {
# $pretty_search_string .=$font."Custom Metadata Search: ".
- # $ENV{'form.custommetadata'}."
\n";
+ # $env{'form.custommetadata'}."
\n";
# $customquery=&build_custommetadata_query('custommetadata',
- # $ENV{'form.custommetadata'});
+ # $env{'form.custommetadata'});
# }
my $customshow=undef;
- # if ($ENV{'form.customshow'}) {
+ # if ($env{'form.customshow'}) {
# $pretty_search_string .=$font."Custom Metadata Display: ".
- # $ENV{'form.customshow'}."
\n";
- # $customshow=$ENV{'form.customshow'};
+ # $env{'form.customshow'}."
\n";
+ # $customshow=$env{'form.customshow'};
# $customshow=~s/[^\w\s]//g;
# my @fields=split(/\s+/,$customshow);
# $customshow=join(" ",@fields);
@@ -1552,16 +1552,16 @@ sub parse_advanced_search {
sub parse_domain_restrictions {
my $libraries_to_query = undef;
- # $ENV{'form.domains'} can be either a scalar or an array reference.
+ # $env{'form.domains'} can be either a scalar or an array reference.
# We need an array.
- if (! exists($ENV{'form.domains'}) || $ENV{'form.domains'} eq '') {
+ if (! exists($env{'form.domains'}) || $env{'form.domains'} eq '') {
return (undef,'',undef);
}
my @allowed_domains;
- if (ref($ENV{'form.domains'})) {
- @allowed_domains = @{$ENV{'form.domains'}};
+ if (ref($env{'form.domains'})) {
+ @allowed_domains = @{$env{'form.domains'}};
} else {
- @allowed_domains = ($ENV{'form.domains'});
+ @allowed_domains = ($env{'form.domains'});
}
#
my %domain_hash = ();
@@ -1613,19 +1613,19 @@ sub parse_basic_search {
#
# Clean up fields for safety
for my $field ('basicexp') {
- $ENV{"form.$field"}=~s/[^\w\s\'\"\!\(\)\-]//g;
+ $env{"form.$field"}=~s/[^\w\s\'\"\!\(\)\-]//g;
}
foreach ('mode','form','element') {
# is this required? Hmmm.
- next unless (exists($ENV{"form.$_"}));
- $ENV{"form.$_"}=&Apache::lonnet::unescape($ENV{"form.$_"});
- $ENV{"form.$_"}=~s/[^\w\/\s\(\)\=\-\"\']//g;
+ next unless (exists($env{"form.$_"}));
+ $env{"form.$_"}=&Apache::lonnet::unescape($env{"form.$_"});
+ $env{"form.$_"}=~s/[^\w\/\s\(\)\=\-\"\']//g;
}
my ($libraries_to_query,$pretty_domains_string,$domain_sql_restriction) =
&parse_domain_restrictions();
#
# Check to see if enough of a query is filled in
- my $search_string = $ENV{'form.basicexp'};
+ my $search_string = $env{'form.basicexp'};
if (! &filled($search_string)) {
&output_blank_field_error($r,$closebutton,'phase=disp_basic');
return OK;
@@ -1637,7 +1637,7 @@ sub parse_basic_search {
'notes','abstract','keywords')
).')';
my ($error,$SQLQuery) = &process_phrase_input($search_string,
- $ENV{'form.related'},
+ $env{'form.related'},
$searchfield);
if ($error) {
&output_unparsed_phrase_error($r,$closebutton,'phase=disp_basic',
@@ -2012,13 +2012,13 @@ sub copyright_check {
$Metadata->{'url'});
# Check for priv
if (($Metadata->{'copyright'} eq 'priv') &&
- (($ENV{'user.name'} ne $resname) &&
- ($ENV{'user.domain'} ne $resdom))) {
+ (($env{'user.name'} ne $resname) &&
+ ($env{'user.domain'} ne $resdom))) {
return 0;
}
# Check for domain
if (($Metadata->{'copyright'} eq 'domain') &&
- ($ENV{'user.domain'} ne $resdom)) {
+ ($env{'user.domain'} ne $resdom)) {
return 0;
}
return 1;
@@ -2099,7 +2099,7 @@ sub print_sort_form {
my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,1).
&Apache::lonhtmlcommon::breadcrumbs
(undef,'Searching','Searching',undef,undef,
- $ENV{'form.catalogmode'} ne 'groupsearch');
+ $env{'form.catalogmode'} ne 'groupsearch');
##
my %SortableFields=&Apache::lonlocal::texthash(
@@ -2118,7 +2118,7 @@ sub print_sort_form {
lastrevisiondate => 'Revision Date'
);
##
- my $table = $ENV{'form.table'};
+ my $table = $env{'form.table'};
return if (! &ensure_db_and_table($r,$table));
##
## Get the number of results
@@ -2139,7 +2139,7 @@ $html
");
# }
return;
@@ -2619,7 +2619,7 @@ sub display_results {
##
## Set viewing function
##
- my $viewfunction = $Views{$ENV{'form.viewselect'}};
+ my $viewfunction = $Views{$env{'form.viewselect'}};
if (!defined($viewfunction)) {
$r->print("Internal Error - Bad view selected.\n");
$r->rflush();
@@ -2635,7 +2635,7 @@ sub display_results {
my $action = "/adm/searchcat?phase=results";
##
## Deal with groupsearch by opening the groupsearch db file.
- if ($ENV{'form.catalogmode'} eq 'groupsearch') {
+ if ($env{'form.catalogmode'} eq 'groupsearch') {
if (! tie(%groupsearch_db,'GDBM_File',$diropendb,
&GDBM_WRCREAT(),0640)) {
$r->print('Unable to store import results.