');
$r->rflush();
# ======================================================= Go through the course
undef %alreadyseen;
@@ -452,6 +495,23 @@ sub untiehash {
} # End of course search scoping
+sub search_html_header {
+ my $Str = <
+
+The LearningOnline Network with CAPA
+
+
+ENDHEADER
+ return $Str;
+}
+
######################################################################
######################################################################
@@ -459,35 +519,21 @@ sub untiehash {
=item &print_basic_search_form()
-Returns a scalar which holds html for the basic search form.
+Prints the form for the basic search. Sorry the name is so cryptic.
=cut
######################################################################
######################################################################
-
-sub print_basic_search_form{
+sub print_basic_search_form {
my ($r,$closebutton,$hidden_fields) = @_;
- my $bodytag=&Apache::loncommon::bodytag('Search');
- my $scrout=<<"ENDDOCUMENT";
-
-
-The LearningOnline Network with CAPA
-
-
-$bodytag
-ENDDOCUMENT
-if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) {
- my $CatalogSearch=&mt('Catalog Search');
- my $Statement=&mt('Enter terms or phrases separated by AND, OR, or NOT then press SEARCH below');
- $scrout.=(<$CatalogSearch
+ my $bodytag=&Apache::loncommon::bodytag('Search').
+ &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching','Finding_Resources',
+ undef,undef,! $ENV{'form.launch'});
+ my $scrout = &search_html_header().$bodytag;
+ if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) {
+ my $Statement=&searchhelp();
+ $scrout.=(<
$hidden_fields
@@ -498,16 +544,23 @@ $Statement.
ENDDOCUMENT
- $scrout.=' '.&simpletextfield('basicexp',$ENV{'form.basicexp'},40).
- ' ';
- my $relatedcheckbox = &simplecheckbox('related','related',$ENV{'form.related'});
- my $domain = $r->dir_config('lonDefDomain');
- my $domaincheckbox = &simplecheckbox('domains',$domain);
- my $srch=&mt('Search');
- my $header=&mt('Advanced Search');
- my $userelatedwords=&mt('use related words');
- my $onlysearchdomain=&mt('only search domain');
- $scrout.=<dir_config('lonDefDomain');
+ my $domaincheckbox =
+ &Apache::lonhtmlcommon::checkbox('domains',
+ $ENV{'form.domains'});
+ my $srch=&mt('Search');
+ my $header=&mt('Advanced Search');
+ my $userelatedwords=&mt('use related words');
+ my $onlysearchdomain=&mt('only search domain');
+ my $view=&viewoptions();
+ $scrout.=<
@@ -580,189 +631,107 @@ ENDDOCUMENT
=item &advanced_search_form()
-Returns a scalar which holds html for the advanced search form.
+Prints the advanced search form.
=cut
######################################################################
######################################################################
-
sub print_advanced_search_form{
my ($r,$closebutton,$hidden_fields) = @_;
+ my %lt=&Apache::lonlocal::texthash('srch' => 'Search',
+ 'reset' => 'Reset',
+ 'help' => 'Help');
my $advanced_buttons = <<"END";
-
-
+
+
$closebutton
-
-
+
END
- if (!defined($ENV{'form.viewselect'})) {
- $ENV{'form.viewselect'} ="Detailed Citation View";
- }
- my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search');
- my $scrout=<<"ENDHEADER";
-
-
-The LearningOnline Network with CAPA
-
-
+ my $bodytag=&Apache::loncommon::bodytag('Advanced Catalog Search').
+ &Apache::lonhtmlcommon::breadcrumbs(undef,'Searching',
+ 'Finding_Resources',
+ undef,undef,
+ ! $ENV{'form.launch'});
+ my $searchhelp=&searchhelp();
+ my $scrout=&search_html_header();
+ $scrout .= <<"ENDHEADER";
$bodytag
-Enter terms or phrases separated by search operators
-such as AND, OR, or NOT.
-
\n";
$scrout.=<
@@ -778,7 +747,105 @@ ENDDOCUMENT
=pod
-=item &get_persistent_form_data
+=item &titlefield()
+
+Inputs: title text
+
+Outputs: titletext with font wrapper
+
+=cut
+
+######################################################################
+######################################################################
+sub titlefield {
+ my $title=shift;
+ return $title;
+}
+
+######################################################################
+######################################################################
+
+=pod
+
+=item viewoptiontext()
+
+Inputs: codename for view option
+
+Outputs: displayed text
+
+=cut
+
+######################################################################
+######################################################################
+sub viewoptiontext {
+ my $code=shift;
+ my %desc=&Apache::lonlocal::texthash
+ ('detailed' => "Detailed Citation View",
+ 'xml' => 'XML/SGML',
+ 'compact' => 'Compact View',
+ 'fielded' => 'Fielded Format',
+ 'summary' => 'Summary View');
+ return $desc{$code};
+}
+
+######################################################################
+######################################################################
+
+=pod
+
+=item viewoptions()
+
+Inputs: none
+
+Outputs: text for box with view options
+
+=cut
+
+######################################################################
+######################################################################
+sub viewoptions {
+ my $scrout="\n".'';
+ if (! defined($ENV{'form.viewselect'})) {
+ $ENV{'form.viewselect'}='detailed';
+ }
+ $scrout.=&Apache::lonmeta::selectbox('viewselect',
+ $ENV{'form.viewselect'},
+ \&viewoptiontext,
+ sort(keys(%Views)));
+ $scrout.= ' ';
+ $scrout.=&Apache::lonmeta::selectbox('show',
+ $ENV{'form.show'},
+ undef,
+ (10,20,50,100,1000,10000));
+ $scrout .= (' 'x2).&mt('Records per Page').''.$/;
+ return $scrout;
+}
+
+######################################################################
+######################################################################
+
+=pod
+
+=item searchhelp()
+
+Inputs: none
+
+Outputs: return little blurb on how to enter searches
+
+=cut
+
+######################################################################
+######################################################################
+sub searchhelp {
+ return &mt('Enter terms or phrases separated by AND, OR, or NOT');
+}
+
+######################################################################
+######################################################################
+
+=pod
+
+=item &get_persistent_form_data()
Inputs: filename of database
@@ -833,7 +900,7 @@ sub get_persistent_form_data {
=pod
-=item &get_persistent_data
+=item &get_persistent_data()
Inputs: filename of database, ref to array of values to recover.
@@ -884,7 +951,7 @@ Inputs: Hash of values to save, filename
Store variables away to the %persistent_db.
Values will be escaped. Values that are array pointers will have their
-elements escaped and concatenated in a comma seperated string.
+elements escaped and concatenated in a comma separated string.
=cut
@@ -916,7 +983,7 @@ Inputs: filename of persistent database.
Store most form variables away to the %persistent_db.
Values will be escaped. Values that are array pointers will have their
-elements escaped and concatenated in a comma seperated string.
+elements escaped and concatenated in a comma separated string.
=cut
@@ -934,288 +1001,6 @@ sub make_form_data_persistent {
}
######################################################################
-# HTML form building functions #
-######################################################################
-
-=pod
-
-=item HTML form building functions
-
-=over 4
-
-=cut
-
-###############################################
-###############################################
-
-=pod
-
-=item &simpletextfield()
-
-Inputs: $name,$value,$size
-
-Returns a text input field with the given name, value, and size.
-If size is not specified, a value of 20 is used.
-
-=cut
-
-###############################################
-###############################################
-
-sub simpletextfield {
- my ($name,$value,$size)=@_;
- $size = 20 if (! defined($size));
- return '';
-}
-
-###############################################
-###############################################
-
-=pod
-
-=item &simplecheckbox()
-
-Inputs: $name,$value,$checked
-
-Returns a simple check box with the given $name.
-If $value eq 'on' the box is checked.
-
-=cut
-
-###############################################
-###############################################
-
-sub simplecheckbox{
- my ($name,$value,$checked)=@_;
- $checked="checked" if ($value eq $checked || $value eq 'on');
- return '';
-}
-
-###############################################
-###############################################
-
-=pod
-
-=item &fieldtitle()
-
-Input: $title
-
-Returns a scalar with html which will display $title as a search
-field heading.
-
-=cut
-
-###############################################
-###############################################
-
-sub fieldtitle {
- my $title = uc(&mt(shift()));
- return ''.$title.
- ': ';
-}
-
-###############################################
-###############################################
-
-=pod
-
-=item &searchphrasefield()
-
-Inputs: $title,$name,$value
-
-Returns html for a title line and an input field for entering search terms.
-The entry field (which is where the $name and $value are used) is a 50 column
-simpletextfield. The html returned is for a row in a three column table.
-
-=cut
-
-###############################################
-###############################################
-
-sub searchphrasefield {
- my ($title,$name,$value)=@_;
- return '
'.&fieldtitle($title).'
'.
- &simpletextfield($name,$value,50)."
\n";
-}
-
-###############################################
-###############################################
-
-=pod
-
-=item &searchphrasefield_with_related()
-
-Inputs: $title,$name,$value
-
-Returns html for a title line and an input field for entering search terms
-and a check box for 'related words'. The entry field (which is where the
-$name and $value are used) is a 50 column simpletextfield. The name of
-the related words checkbox is "$name_related".
-
-=cut
-
-###############################################
-###############################################
-
-sub searchphrasefield_with_related {
- my ($title,$name,$value)=@_;
- return '