--- loncom/interface/lonsearchcat.pm 2002/06/18 21:36:38 1.121
+++ loncom/interface/lonsearchcat.pm 2002/06/19 20:39:11 1.123
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Search Catalog
#
-# $Id: lonsearchcat.pm,v 1.121 2002/06/18 21:36:38 matthew Exp $
+# $Id: lonsearchcat.pm,v 1.123 2002/06/19 20:39:11 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -137,11 +137,6 @@ allows for quickly limiting to oneself
The ubiquitous database hash
-=item $basicviewselect and $advancedviewselect
-
-View selection forms. These are not actually global and will be
-moved soon.
-
=item $diropendb
The full path to the (temporary) search database file. This is set and
@@ -174,24 +169,6 @@ my %hash; # database hash
# Summary View ---> sub summary_view
# Fielded Format ---> sub fielded_format_view
# XML/SGML ---> sub xml_sgml_view
-my $basicviewselect=<
-
-
-
-
-
-END
-my $advancedviewselect=<
-
-
-
-
-
-END
#------------------------------------------------------------- global variables
my $diropendb = "";
@@ -236,8 +213,8 @@ sub handler {
return OK if $r->header_only;
my $domain = $r->dir_config('lonDefDomain');
- $diropendb= "/home/httpd/perl/tmp/".&Apache::lonnet::unescape($domain).
- "\_".&Apache::lonnet::unescape($ENV{'user.name'})."_searchcat.db";
+ $diropendb= "/home/httpd/perl/tmp/".&Apache::lonnet::escape($domain).
+ "\_".&Apache::lonnet::escape($ENV{'user.name'})."_searchcat.db";
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['catalogmode','launch','acts','mode','form','element']);
@@ -246,8 +223,7 @@ sub handler {
if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT,0640)) {
&start_fresh_session();
untie %hash;
- }
- else {
+ } else {
$r->print('Unable to tie hash to db '.
'file');
return OK;
@@ -459,7 +435,15 @@ ENDDOCUMENT
$closebutton
-$basicviewselect
+
+
+
@@ -469,7 +453,15 @@ $scrout
$closebutton
-$advancedviewselect
+
+
+
@@ -488,13 +480,12 @@ ENDDOCUMENT
Returns a scalar which holds the current ENV{'form.*'} values in
a 'hidden' html input tag.
+
=cut
######################################################################
######################################################################
-# ------------------------------------------------------------- make persistent
-
sub make_persistent {
my $persistent='';
@@ -512,31 +503,73 @@ END
return $persistent;
}
-# --------------------------------------------------------- Various form fields
+
+######################################################################
+######################################################################
+
+=pod
+
+=item HTML form building functions
+
+=over 4
+
+=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.
+
+=item &simplecheckbox()
+
+Inputs: $name,$value
+
+Returns a simple check box with the given $name.
+If $value eq 'on' the box is checked.
+
+=item &searchphrasefield()
+
+Inputs: $title,$name,$value
+
+Returns html for a title line and an input field for entering search terms.
+the instructions "Enter terms or phrases separated by search operators such
+as AND, OR, or NOT." are given following the title. The entry field (which
+is where the $name and $value are used) is an 80 column simpletextfield.
+
+=item &dateboxes()
+
+=item &selectbox()
+
+=back
+
+=cut
+
+######################################################################
+######################################################################
sub simpletextfield {
- my ($name,$value)=@_;
- return '';
+ my ($name,$value,$size)=@_;
+ $size = 20 if (! defined($size));
+ return '';
}
sub simplecheckbox {
my ($name,$value)=@_;
my $checked='';
$checked="CHECKED" if $value eq 'on';
- return '';
+ return '';
}
sub searchphrasefield {
my ($title,$name,$value)=@_;
my $instruction=<$uctitle:".
- " $instruction ".
- '';
+ return "\n".
+ '
'.$uctitle.':'.
+ " $instruction ".&simpletextfield($name,$value,80);
}
sub dateboxes {
@@ -586,26 +619,35 @@ END
sub selectbox {
my ($title,$name,$value,$anyvalue,$anytag,$functionref,@idlist)=@_;
my $uctitle=uc($title);
- my $selout="\n