Annotation of loncom/interface/lonsearchcat.pm, revision 1.99

1.98      harris41    1: # The LearningOnline Network with CAPA
                      2: #
1.1       www         3: # Search Catalog
                      4: #
1.97      harris41    5: # YEAR=2001
1.2       harris41    6: # 03/08/2001 Scott Harrison
1.42      harris41    7: # Scott Harrison: 03/12/2001, 03/13/2001, 03/14/2001, 03/15/2001, 03/19/2001
1.91      harris41    8: # Scott Harrison: 03/20/2001, 03/21/2001, 03/22/2001, 03/26/2001, 03/27/2001
1.98      harris41    9: # Scott Harrison: 04/02/2001, 08/15/2001, 08/24/2001, 08/25/2001
                     10: 
                     11: ###############################################################################
                     12: ##                                                                           ##
                     13: ## ORGANIZATION OF THIS PERL MODULE                                          ##
                     14: ##                                                                           ##
                     15: ## 1. Description of functions                                               ##
                     16: ## 2. Modules used by this module                                            ##
                     17: ## 3. Choices for different output views (detailed, summary, xml, etc)       ##
                     18: ## 4. BEGIN block (to be run once after compilation)                         ##
                     19: ## 5. Handling routine called via Apache and mod_perl                        ##
                     20: ## 6. Other subroutines                                                      ##
                     21: ##                                                                           ##
                     22: ###############################################################################
                     23: 
                     24: # ---------------------------------------------------- Description of functions
1.1       www        25: #
1.41      harris41   26: #
1.98      harris41   27: # === WEB HANDLER FUNCTIONS
                     28: # BEGIN() : run once after compilation to initialize values
1.41      harris41   29: # handler(server reference) : interacts with the Apache server layer
                     30: #                             (for /adm/searchcat URLs)
1.98      harris41   31: # get_unprocessed_cgi() : reads in critical name/value pairs that may have not
                     32: #                         been processed and passed into %ENV by the web server
                     33: # make_persistent() : makes a set of hidden HTML fields to make
                     34: #                     SQL search interface information to be persistent
                     35: #
                     36: #
                     37: # === WEB INTERFACE COMPONENT FUNCTIONS
1.41      harris41   38: # simpletextfield(name,value) : returns HTML formatted string for simple text
                     39: #                               field
                     40: # simplecheckbox(name,value) : returns HTML formatted string for simple
                     41: #                              checkbox
                     42: # searchphrasefield(title,name,value) : returns HTML formatted string for
                     43: #                                       a search expression phrase field
                     44: # dateboxes(name, defaultmonth, defaultday, defaultyear) : returns HTML
                     45: #                                                          formatted string
                     46: #                                                          for a calendar date
                     47: # selectbox(title,name,value,%HASH=options) : returns HTML formatted string for
                     48: #                                             a selection box field
1.98      harris41   49: #
                     50: #
                     51: # === SEARCH FUNCTIONS
1.42      harris41   52: # advancedsearch(server reference, environment reference) : perform a complex
                     53: #                                  multi-field logical query
                     54: # basicsearch(server reference, environment reference) : perform a simple
                     55: #                               single-field logical query
1.43      harris41   56: # build_SQL_query(field name, logic) : builds a SQL query string from a
                     57: #                                      logical expression with AND/OR keywords
1.98      harris41   58: # build_custommetadata_query(field_name, logic_statement) : builds a perl
                     59: #                 regular expression from a logical expression with AND/OR
                     60: #                 keywords
1.43      harris41   61: # recursive_SQL_query_build(field name, reverse notation expression) : 
                     62: #                 builds a SQL query string from a reverse notation expression
                     63: #                 logical expression with AND/OR keywords
1.90      harris41   64: # build_date_queries(cmonth1, cday1, cyear1, cmonth2, cday2, cyear2,
                     65: #                    lmonth1, lday1, lyear1, lmonth2, lday2, lyear2) :
1.98      harris41   66: #                 Builds a SQL logic query to check time/date entries.
                     67: #
                     68: #
                     69: # === OUTPUTTING RESULTS FUNCTION
                     70: # output_results(output mode,
                     71: #                server reference, 
                     72: #                environment reference,
                     73: #                reply list reference) : outputs results from search
                     74: #
                     75: #
                     76: # === DIFFERENT WAYS TO VIEW METADATA RECORDS
                     77: # detailed_citation_view(ORDERED METADATA LIST FOR A RESULT OBJECT INSTANCE) :
                     78: #          see metadata viewing notes below 
                     79: # summary_view(ORDERED METADATA LIST FOR A RESULT OBJECT INSTANCE) :
                     80: #          see metadata viewing notes below 
                     81: # fielded_format_view(ORDERED METADATA LIST FOR A RESULT OBJECT INSTANCE) :
                     82: #          see metadata viewing notes below 
                     83: # xml_sgml_view(ORDERED METADATA LIST FOR A RESULT OBJECT INSTANCE) :
                     84: #          see metadata viewing notes below 
                     85: #  ___________________________________________________________________________
                     86: # | * Metadata viewing notes                                                  |
                     87: # | Output is a HTML-ified string.                                            |
                     88: # | Input arguments are title, author, subject, url, keywords, version, notes,|
                     89: # | short abstract, mime, language, creation date, last revision date, owner, |
                     90: # | copyright, hostname, httphost, and extra custom metadata to show.         |
                     91: #  ---------------------------------------------------------------------------
                     92: #
                     93: #
                     94: # === TEST CONDITIONAL FUNCTIONS
                     95: # filled(field) : determines whether a given field has been filled
                     96: #
                     97: #
                     98: # === ERROR FUNCTIONS
                     99: # output_blank_field_error(server reference) : outputs a message saying that
                    100: #                                              more fields need to be filled in
1.90      harris41  101: # output_date_error(server reference, error message) : outputs
                    102: #         an error message specific to bad date format.
1.41      harris41  103: 
1.1       www       104: package Apache::lonsearchcat;
                    105: 
1.98      harris41  106: # ------------------------------------------------- modules used by this module
1.1       www       107: use strict;
                    108: use Apache::Constants qw(:common);
1.6       harris41  109: use Apache::lonnet();
                    110: use Apache::File();
1.7       harris41  111: use CGI qw(:standard);
1.41      harris41  112: use Text::Query;
1.1       www       113: 
1.90      harris41  114: # ---------------------------------------- variables used throughout the module
                    115: 
1.98      harris41  116: # -- information holders
                    117: my %language; # holds contents of language.tab
                    118: my %cprtag; # holds contents of copyright.tab
                    119: my %mimetag; # holds contents of filetypes.tab
                    120: my %hostdomains; # matches host name to host domain
                    121: my %hostips; # matches host name to host ip
                    122: my %hitcount; # stores number of hits per host
                    123: 
                    124: # -- dynamically rendered interface components
                    125: my $closebutton; # button that closes the search window
                    126: my $importbutton; # button to take the selected results and go to group sorting
                    127: 
                    128: # -- miscellaneous variables
                    129: my $scrout; # string that holds portions of the screen output
                    130: my $fnum; # search result counter
                    131: my $yourself; # allows for quickly limiting to oneself
                    132: 
                    133: # ------------------------------------------ choices for different output views
                    134: # Detailed Citation View ---> sub detailed_citation_view
1.90      harris41  135: # Summary View ---> sub summary_view
                    136: # Fielded Format ---> sub fielded_format_view
                    137: # XML/SGML ---> sub xml_sgml_view
1.55      harris41  138: my $basicviewselect=<<END;
                    139: <select name='basicviewselect'>
                    140: <option value='Detailed Citation View'>Detailed Citation View</option>
                    141: <option value='Summary View'>Summary View</option>
                    142: <option value='Fielded Format'>Fielded Format</option>
                    143: <option value='XML/SGML'>XML/SGML</option>
                    144: </select>
                    145: END
                    146: my $advancedviewselect=<<END;
                    147: <select name='advancedviewselect'>
1.50      harris41  148: <option value='Detailed Citation View'>Detailed Citation View</option>
                    149: <option value='Summary View'>Summary View</option>
                    150: <option value='Fielded Format'>Fielded Format</option>
                    151: <option value='XML/SGML'>XML/SGML</option>
1.46      harris41  152: </select>
                    153: END
1.3       harris41  154: 
1.98      harris41  155: # ----------------------------------------------------------------------- BEGIN
                    156: sub BEGIN {
1.8       harris41  157: # --------------------------------- Compute various listings of metadata values
1.3       harris41  158:     $language{'any'}='Any language';
                    159:     {
1.98      harris41  160: 	my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
                    161: 				 '/language.tab');
1.3       harris41  162: 	map {
1.57      harris41  163: 	    $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
1.3       harris41  164: 	    $language{$1}=$2;
                    165: 	} <$fh>;
                    166:     }
                    167:     $cprtag{'any'}='Any copyright/distribution';
                    168:     {
1.98      harris41  169: 	my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonIncludes'}.
                    170: 				 '/copyright.tab');
1.3       harris41  171: 	map {
1.57      harris41  172: 	    $_=~/(\w+)\s+([\w\s\-]+)/; chomp;
1.3       harris41  173: 	    $cprtag{$1}=$2;
                    174: 	} <$fh>;
                    175:     }
                    176:     $mimetag{'any'}='Any type';
                    177:     {
1.98      harris41  178: 	my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
                    179: 				 '/filetypes.tab');
1.3       harris41  180: 	map {
1.57      harris41  181: 	    $_=~/(\w+)\s+(\w+)\s+([\w\s\-]+)/; chomp;
1.3       harris41  182: 	    $mimetag{$1}=".$1 $3";
                    183: 	} <$fh>;
                    184:     }
1.98      harris41  185:     {
                    186: 	my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
                    187: 				 '/hosts.tab');
                    188: 	map {
                    189: 	    $_=~/(\w+?)\:(\w+?)\:(\w+?)\:(.*)/; chomp;
                    190: 	    if ($3 eq 'library') {
                    191: 		$hostdomains{$1}=$2;
                    192: 		$hostips{$1}=$4;
                    193: 	    }
                    194: 	} <$fh>;
                    195:     }
                    196: }
                    197: 
                    198: # ----------------------------- Handling routine called via Apache and mod_perl
                    199: sub handler {
                    200:     my $r = shift;
                    201: 
                    202:     &get_unprocessed_cgi();
                    203: 
                    204:     $r->content_type('text/html');
                    205:     $r->send_http_header;
                    206:     return OK if $r->header_only;
                    207: 
                    208: # ----------------------------------- configure dynamic components of interface
                    209:     my $hidden='';
                    210:     if ($ENV{'form.catalogmode'} eq 'interactive') {
                    211: 	$hidden="<input type='hidden' name='catalogmode' value='interactive'>".
                    212: 	    "\n";
                    213:         $closebutton="<input type='button' name='close' value='CLOSE' ".
                    214: 	    "onClick='self.close()'>"."\n";
                    215:     }
                    216:     elsif ($ENV{'form.catalogmode'} eq 'groupsearch') {
                    217: 	$hidden=<<END;
                    218: <input type='hidden' name='catalogmode' value='groupsearch'>
                    219: END
                    220:         $closebutton=<<END;
                    221: <input type='button' name='close' value='CLOSE' onClick='self.close()'>
                    222: END
                    223:         $importbutton=<<END;
                    224: <input type='button' name='import' value='IMPORT'
                    225: onClick='javascript:select_group()'>
                    226: END
                    227:     }
                    228: 
                    229: # ------------------------------------------------------ Determine current user
                    230:     $yourself=$ENV{'user.name'}.'@'.$ENV{'user.domain'};
                    231: 
                    232: # --- Now, depending on the interface actions, do one of three things here:
                    233: # --- 1. a basic search
                    234: # --- 2. an advanced search
                    235: # --- 3. output a search interface
1.3       harris41  236: 
1.90      harris41  237: # ----------------------------------- See if a search invocation should be done
1.6       harris41  238:     if ($ENV{'form.basicsubmit'} eq 'SEARCH') {
1.19      harris41  239: 	return &basicsearch($r,\%ENV);
1.6       harris41  240:     }
1.18      harris41  241:     elsif ($ENV{'form.advancedsubmit'} eq 'SEARCH') {
                    242: 	return &advancedsearch($r,\%ENV);
                    243:     }
1.6       harris41  244: 
1.90      harris41  245: # ----------------------------- Else, begin building search interface to output
1.8       harris41  246:     $scrout=''; # building a part of screen output
1.3       harris41  247:     $scrout.=&searchphrasefield('Limit by title','title',
1.11      harris41  248: 			$ENV{'form.title'});
1.3       harris41  249: 
                    250:     $scrout.=&searchphrasefield('Limit by author','author',
1.11      harris41  251: 			$ENV{'form.author'});
1.3       harris41  252: 
                    253:     $scrout.=&searchphrasefield('Limit by subject','subject',
1.11      harris41  254: 			$ENV{'form.subject'});
                    255: 
                    256:     $scrout.=&searchphrasefield('Limit by keywords','keywords',
                    257: 			$ENV{'form.keywords'});
                    258: 
                    259:     $scrout.=&searchphrasefield('Limit by URL','url',
                    260: 			$ENV{'form.url'});
                    261: 
1.96      harris41  262: #    $scrout.=&searchphrasefield('Limit by version','version',
                    263: #			$ENV{'form.version'});
1.3       harris41  264: 
                    265:     $scrout.=&searchphrasefield('Limit by notes','notes',
1.11      harris41  266: 			$ENV{'form.notes'});
1.3       harris41  267: 
                    268:     $scrout.=&searchphrasefield('Limit by abstract','abstract',
1.11      harris41  269: 			$ENV{'form.abstract'});
1.3       harris41  270: 
1.11      harris41  271:     $ENV{'form.mime'}='notxxx' unless length($ENV{'form.mime'});
1.3       harris41  272:     $scrout.=&selectbox('Limit by MIME type','mime',
1.11      harris41  273: 			$ENV{'form.mime'},%mimetag);
                    274: 
                    275:     $ENV{'form.language'}='any' unless length($ENV{'form.language'});
1.3       harris41  276: 
                    277:     $scrout.=&selectbox('Limit by language','language',
1.11      harris41  278: 			$ENV{'form.language'},%language);
1.3       harris41  279:     
1.8       harris41  280: 
                    281: # ------------------------------------------------ Compute date selection boxes
                    282:     $scrout.=<<CREATIONDATESTART;
1.3       harris41  283: <p>
                    284: <font color="#800000" face="helvetica"><b>LIMIT BY CREATION DATE RANGE:</b>
                    285: </font>
1.98      harris41  286: <br />
1.8       harris41  287: between:
                    288: CREATIONDATESTART
1.11      harris41  289:     $scrout.=&dateboxes('creationdatestart',1,1,1976,
                    290: 			$ENV{'form.creationdatestart_month'},
                    291: 			$ENV{'form.creationdatestart_day'},
                    292: 			$ENV{'form.creationdatestart_year'},
                    293: 			);
1.8       harris41  294:     $scrout.=<<CREATIONDATEEND;
                    295: and:
                    296: CREATIONDATEEND
1.11      harris41  297:     $scrout.=&dateboxes('creationdateend',12,31,2051,
                    298: 			$ENV{'form.creationdateend_month'},
                    299: 			$ENV{'form.creationdateend_day'},
                    300: 			$ENV{'form.creationdateend_year'},
                    301: 			);
1.8       harris41  302:     $scrout.="</p>";
                    303: 
                    304:     $scrout.=<<LASTREVISIONDATESTART;
                    305: <p>
                    306: <font color="#800000" face="helvetica"><b>LIMIT BY LAST REVISION DATE RANGE:
                    307: </b></font>
1.98      harris41  308: <br />between:
1.8       harris41  309: LASTREVISIONDATESTART
1.11      harris41  310:     $scrout.=&dateboxes('lastrevisiondatestart',1,1,1976,
                    311: 			$ENV{'form.lastrevisiondatestart_month'},
                    312: 			$ENV{'form.lastrevisiondatestart_day'},
                    313: 			$ENV{'form.lastrevisiondatestart_year'},
                    314: 			);
1.8       harris41  315:     $scrout.=<<LASTREVISIONDATEEND;
                    316: and:
                    317: LASTREVISIONDATEEND
1.11      harris41  318:     $scrout.=&dateboxes('lastrevisiondateend',12,31,2051,
                    319: 			$ENV{'form.lastrevisiondateend_month'},
                    320: 			$ENV{'form.lastrevisiondateend_day'},
                    321: 			$ENV{'form.lastrevisiondateend_year'},
                    322: 			);
1.8       harris41  323:     $scrout.='</p>';
                    324: 
                    325:     $scrout.=&searchphrasefield('Limit by publisher/owner','owner',
1.11      harris41  326: 				$ENV{'form.owner'});
1.8       harris41  327: 
1.11      harris41  328:     $ENV{'form.copyright'}='any' unless length($ENV{'form.copyright'});
1.8       harris41  329:     $scrout.=&selectbox('Limit by copyright/distribution','copyright',
1.11      harris41  330: 			$ENV{'form.copyright'},%cprtag);
1.8       harris41  331: 
1.14      harris41  332: # ------------------------------------------- Compute customized metadata field
                    333:     $scrout.=<<CUSTOMMETADATA;
                    334: <p>
1.77      harris41  335: <font color="#800000" face="helvetica"><b>LIMIT BY SPECIAL METADATA FIELDS:</b>
1.14      harris41  336: </font>
1.77      harris41  337: For resource-specific metadata, enter in an expression in the form of 
1.98      harris41  338: <i>key</i>=<i>value</i> separated by operators such as AND or OR.<br />
1.14      harris41  339: <b>Example:</b> grandmother=75 OR grandfather=85
1.98      harris41  340: <br />
1.14      harris41  341: CUSTOMMETADATA
                    342: $scrout.=&simpletextfield('custommetadata',$ENV{'form.custommetadata'});
1.15      harris41  343: $scrout.=' <i>initial users of this system do not need to worry about this option</i>';
1.14      harris41  344: 
1.77      harris41  345:     $scrout.=<<CUSTOMSHOW;
                    346: <p>
                    347: <font color="#800000" face="helvetica"><b>SHOW SPECIAL METADATA FIELDS:</b>
                    348: </font>
                    349: Enter in a space-separated list of special metadata fields to show
                    350: in a fielded listing for each record result.
1.98      harris41  351: <br />
1.77      harris41  352: CUSTOMSHOW
                    353: $scrout.=&simpletextfield('customshow',$ENV{'form.customshow'});
                    354: $scrout.=' <i>initial users of this system do not need to worry about this option</i>';
                    355: 
1.8       harris41  356: # ---------------------------------------------------------------- Print screen
                    357:     $r->print(<<ENDDOCUMENT);
                    358: <html>
                    359: <head>
                    360: <title>The LearningOnline Network with CAPA</title>
                    361: </head>
                    362: <body bgcolor="#FFFFFF">
1.98      harris41  363: <img align='right' src='/adm/lonIcons/lonlogos.gif' />
1.8       harris41  364: <h1>Search Catalog</h1>
                    365: <form method="post" action="/adm/searchcat">
                    366: $hidden
1.98      harris41  367: <hr />
1.8       harris41  368: <h3>Basic Search</h3>
                    369: <p>
                    370: Enter terms or phrases separated by search operators
                    371: such as AND or OR then press SEARCH below.  Terms should be specific
                    372: to the title, author, subject, notes, or abstract information associated
                    373: with a resource.
1.98      harris41  374: <br />
1.11      harris41  375: ENDDOCUMENT
                    376:     $r->print(&simpletextfield('basicexp',$ENV{'form.basicexp'}));
                    377:     $r->print(' ');
                    378:     $r->print(&simplecheckbox('titleonly',$ENV{'form.titleonly'}));
                    379:     $r->print('<font color="#800000">Title only</font> ');
1.96      harris41  380: #    $r->print(&simplecheckbox('allversions',$ENV{'form.allversions'}));
                    381: # <font color="#800000">Search historic archives</font>
1.11      harris41  382:     $r->print(<<ENDDOCUMENT);
1.98      harris41  383: <br />
1.68      harris41  384: <input type="submit" name="basicsubmit" value='SEARCH' />
                    385: <input type="reset" name="reset" value='RESET' />
1.46      harris41  386: $closebutton
1.55      harris41  387: $basicviewselect
1.8       harris41  388: </p>
1.98      harris41  389: <hr />
1.8       harris41  390: <h3>Advanced Search</h3>
                    391: $scrout
                    392: <p>
1.68      harris41  393: <input type="submit" name="advancedsubmit" value='SEARCH' />
                    394: <input type="reset" name="reset" value='RESET' />
1.46      harris41  395: $closebutton
1.55      harris41  396: $advancedviewselect
1.3       harris41  397: </p>
1.8       harris41  398: </form>
                    399: </body>
                    400: </html>
                    401: ENDDOCUMENT
                    402:     return OK;
                    403: } 
                    404: 
1.98      harris41  405: # ----------- grab unprocessed CGI variables that may have been appended to URL
                    406: sub get_unprocessed_cgi {
                    407:     map {
                    408:        my ($name, $value) = split(/=/,$_);
                    409:        $value =~ tr/+/ /;
                    410:        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
                    411:        if ($name eq 'catalogmode') {
                    412: 	   $ENV{'form.'.$name}=$value;
                    413:        }
                    414:     } (split(/&/,$ENV{'QUERY_STRING'}));
                    415: }
                    416: 
                    417: # ------------------------------------------------------------- make persistent
                    418: sub make_persistent {
                    419:     my $persistent='';
                    420:     
                    421:     map {
                    422: 	if (/^form\./ && !/submit/) {
                    423: 	    my $name=$_;
                    424: 	    my $key=$name;
                    425: 	    $ENV{$key}=~s/\'//g; # do not mess with html field syntax
                    426: 	    $name=~s/^form\.//;
                    427: 	    $persistent.=<<END;
                    428: <input type='hidden' name='$name' value='$ENV{$key}' />
                    429: END
                    430:         }
                    431:     } (keys %ENV);
                    432:     return $persistent;
                    433: }
                    434: 
1.8       harris41  435: # --------------------------------------------------------- Various form fields
                    436: 
1.11      harris41  437: sub simpletextfield {
                    438:     my ($name,$value)=@_;
1.68      harris41  439:     return '<input type=text name=\''.$name.
                    440: 	   '\' size=20 value=\''.$value.'\' />';
1.11      harris41  441: }
                    442: 
                    443: sub simplecheckbox {
                    444:     my ($name,$value)=@_;
                    445:     my $checked='';
                    446:     $checked="CHECKED" if $value eq 'on';
1.68      harris41  447:     return '<input type=checkbox name=\''.$name.'\' '. $checked . '>';
1.11      harris41  448: }
                    449: 
1.8       harris41  450: sub searchphrasefield {
                    451:     my ($title,$name,$value)=@_;
                    452:     my $instruction=<<END;
                    453: Enter terms or phrases separated by search operators such
                    454: as AND or OR.
                    455: END
                    456:     my $uctitle=uc($title);
                    457:     return "\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:</b>".
1.98      harris41  458: 	   "</FONT> $instruction<br />".
1.68      harris41  459:            '<input type=text name="'.$name.'" size=80 value=\''.$value.'\'>';
1.8       harris41  460: }
1.3       harris41  461: 
1.8       harris41  462: sub dateboxes {
1.11      harris41  463:     my ($name,$defaultmonth,$defaultday,$defaultyear,
                    464: 	$currentmonth,$currentday,$currentyear)=@_;
                    465:     ($defaultmonth,$defaultday,$defaultyear)=('','','');
                    466:     my $month=<<END;
1.8       harris41  467: <select name="${name}_month">
1.11      harris41  468: <option value='$defaultmonth'> </option>
                    469: <option value="1">January</option>
                    470: <option value="2">February</option>
                    471: <option value="3">March</option>
                    472: <option value="4">April</option>
                    473: <option value="5">May</option>
                    474: <option value="6">June</option>
                    475: <option value="7">July</option>
                    476: <option value="8">August</option>
                    477: <option value="9">September</option>
1.3       harris41  478: <option value="10">October</option>
                    479: <option value="11">November</option>
                    480: <option value="12">December</option>
                    481: </select>
1.11      harris41  482: END
                    483:     $month=~s/(\"$currentmonth\")/$1 SELECTED/ if length($currentmonth);
                    484:     my $day=<<END;
1.8       harris41  485: <select name="${name}_day">
1.11      harris41  486: <option value='$defaultday'> </option>
                    487: <option value="1">1</option>
                    488: <option value="2">2</option>
                    489: <option value="3">3</option>
                    490: <option value="4">4</option>
                    491: <option value="5">5</option>
                    492: <option value="6">6</option>
                    493: <option value="7">7</option>
                    494: <option value="8">8</option>
                    495: <option value="9">9</option>
                    496: <option value="10">10</option>
                    497: <option value="11">11</option>
                    498: <option value="12">12</option>
                    499: <option value="13">13</option>
                    500: <option value="14">14</option>
                    501: <option value="15">15</option>
                    502: <option value="16">16</option>
                    503: <option value="17">17</option>
                    504: <option value="18">18</option>
                    505: <option value="19">19</option>
                    506: <option value="20">20</option>
                    507: <option value="21">21</option>
                    508: <option value="22">22</option>
                    509: <option value="23">23</option>
                    510: <option value="24">24</option>
                    511: <option value="25">25</option>
                    512: <option value="26">26</option>
                    513: <option value="27">27</option>
                    514: <option value="28">28</option>
                    515: <option value="29">29</option>
                    516: <option value="30">30</option>
                    517: <option value="31">31</option>
1.3       harris41  518: </select>
1.11      harris41  519: END
                    520:     $day=~s/(\"$currentday\")/$1 SELECTED/ if length($currentday);
                    521:     my $year=<<END;
1.8       harris41  522: <select name="${name}_year">
1.11      harris41  523: <option value='$defaultyear'> </option>
                    524: <option value="1976">1976</option>
                    525: <option value="1977">1977</option>
                    526: <option value="1978">1978</option>
                    527: <option value="1979">1979</option>
                    528: <option value="1980">1980</option>
                    529: <option value="1981">1981</option>
                    530: <option value="1982">1982</option>
                    531: <option value="1983">1983</option>
                    532: <option value="1984">1984</option>
                    533: <option value="1985">1985</option>
                    534: <option value="1986">1986</option>
                    535: <option value="1987">1987</option>
                    536: <option value="1988">1988</option>
                    537: <option value="1989">1989</option>
                    538: <option value="1990">1990</option>
                    539: <option value="1991">1991</option>
                    540: <option value="1992">1992</option>
                    541: <option value="1993">1993</option>
                    542: <option value="1994">1994</option>
                    543: <option value="1995">1995</option>
                    544: <option value="1996">1996</option>
                    545: <option value="1997">1997</option>
                    546: <option value="1998">1998</option>
                    547: <option value="1999">1999</option>
                    548: <option value="2000">2000</option>
                    549: <option value="2001">2001</option>
                    550: <option value="2002">2002</option>
                    551: <option value="2003">2003</option>
                    552: <option value="2004">2004</option>
                    553: <option value="2005">2005</option>
                    554: <option value="2006">2006</option>
                    555: <option value="2007">2007</option>
                    556: <option value="2008">2008</option>
                    557: <option value="2009">2009</option>
                    558: <option value="2010">2010</option>
                    559: <option value="2011">2011</option>
                    560: <option value="2012">2012</option>
                    561: <option value="2013">2013</option>
                    562: <option value="2014">2014</option>
                    563: <option value="2015">2015</option>
                    564: <option value="2016">2016</option>
                    565: <option value="2017">2017</option>
                    566: <option value="2018">2018</option>
                    567: <option value="2019">2019</option>
                    568: <option value="2020">2020</option>
                    569: <option value="2021">2021</option>
                    570: <option value="2022">2022</option>
                    571: <option value="2023">2023</option>
                    572: <option value="2024">2024</option>
                    573: <option value="2025">2025</option>
                    574: <option value="2026">2026</option>
                    575: <option value="2027">2027</option>
                    576: <option value="2028">2028</option>
                    577: <option value="2029">2029</option>
                    578: <option value="2030">2030</option>
                    579: <option value="2031">2031</option>
                    580: <option value="2032">2032</option>
                    581: <option value="2033">2033</option>
                    582: <option value="2034">2034</option>
                    583: <option value="2035">2035</option>
                    584: <option value="2036">2036</option>
                    585: <option value="2037">2037</option>
                    586: <option value="2038">2038</option>
                    587: <option value="2039">2039</option>
                    588: <option value="2040">2040</option>
                    589: <option value="2041">2041</option>
                    590: <option value="2042">2042</option>
                    591: <option value="2043">2043</option>
                    592: <option value="2044">2044</option>
                    593: <option value="2045">2045</option>
                    594: <option value="2046">2046</option>
                    595: <option value="2047">2047</option>
                    596: <option value="2048">2048</option>
                    597: <option value="2049">2049</option>
                    598: <option value="2050">2050</option>
                    599: <option value="2051">2051</option>
1.3       harris41  600: </select>
                    601: END
1.11      harris41  602:     $year=~s/(\"$currentyear\")/$1 SELECTED/ if length($currentyear);
                    603:     return "$month$day$year";
1.3       harris41  604: }
                    605: 
                    606: sub selectbox {
                    607:     my ($title,$name,$value,%options)=@_;
                    608:     my $uctitle=uc($title);
                    609:     my $selout="\n<p><font color=\"#800000\" face=\"helvetica\"><b>$uctitle:".
1.98      harris41  610: 	"</b></font><br />".'<select name="'.$name.'">';
1.3       harris41  611:     map {
1.68      harris41  612:         $selout.='<option value=\''.$_.'\'';
1.3       harris41  613:         if ($_ eq $value) { $selout.=' selected'; }
                    614:         $selout.='>'.$options{$_}.'</option>';
                    615:     } sort keys %options;
                    616:     return $selout.'</select>';
1.6       harris41  617: }
                    618: 
1.45      harris41  619: # ----------------------------------------------- Performing an advanced search
1.18      harris41  620: sub advancedsearch {
                    621:     my ($r,$envhash)=@_;
                    622:     my %ENV=%{$envhash};
                    623: 
1.32      harris41  624:     my $fillflag=0;
1.64      harris41  625:     # Clean up fields for safety
                    626:     for my $field ('title','author','subject','keywords','url','version',
                    627: 		   'creationdatestart_month','creationdatestart_day',
                    628: 		   'creationdatestart_year','creationdateend_month',
                    629: 		   'creationdateend_day','creationdateend_year',
                    630: 		   'lastrevisiondatestart_month','lastrevisiondatestart_day',
                    631: 		   'lastrevisiondatestart_year','lastrevisiondateend_month',
                    632: 		   'lastrevisiondateend_day','lastrevisiondateend_year',
                    633: 		   'notes','abstract','mime','language','owner',
1.77      harris41  634: 		   'custommetadata','customshow') {
1.68      harris41  635: 	$ENV{"form.$field"}=~s/[^\w\s\(\)\=\-\"\']//g;
1.64      harris41  636:     }
1.90      harris41  637: 
                    638:     # Check to see if enough information was filled in
1.32      harris41  639:     for my $field ('title','author','subject','keywords','url','version',
                    640: 		   'notes','abstract','mime','language','owner',
                    641: 		   'custommetadata') {
1.40      harris41  642: 	if (&filled($ENV{"form.$field"})) {
1.32      harris41  643: 	    $fillflag++;
                    644: 	}
                    645:     }
                    646:     unless ($fillflag) {
                    647: 	&output_blank_field_error($r);
                    648: 	return OK;
                    649:     }
1.39      harris41  650: 
1.90      harris41  651: 
                    652:     # Turn the form input into a SQL-based query
1.39      harris41  653:     my $query='';
1.44      harris41  654: 
1.45      harris41  655:     my @queries;
1.90      harris41  656:     # Evaluate logical expression AND/OR/NOT phrase fields.
1.58      harris41  657:     foreach my $field ('title','author','subject','notes','abstract','url',
                    658: 		       'keywords','version','owner') {
1.44      harris41  659: 	if ($ENV{'form.'.$field}) {
1.45      harris41  660: 	    push @queries,&build_SQL_query($field,$ENV{'form.'.$field});
1.44      harris41  661: 	}
                    662:     }
1.90      harris41  663:     # Evaluate option lists
1.58      harris41  664:     if ($ENV{'form.language'} and $ENV{'form.language'} ne 'any') {
1.90      harris41  665: 	push @queries,"(language like \"$ENV{'form.language'}\")";
1.58      harris41  666:     }
                    667:     if ($ENV{'form.mime'} and $ENV{'form.mime'} ne 'any') {
1.90      harris41  668: 	push @queries,"(mime like \"$ENV{'form.mime'}\")";
1.58      harris41  669:     }
                    670:     if ($ENV{'form.copyright'} and $ENV{'form.copyright'} ne 'any') {
1.90      harris41  671: 	push @queries,"(copyright like \"$ENV{'form.copyright'}\")";
1.58      harris41  672:     }
1.90      harris41  673:     # Evaluate date windows
1.60      harris41  674:     my $datequery=&build_date_queries(
                    675: 			$ENV{'form.creationdatestart_month'},
                    676: 			$ENV{'form.creationdatestart_day'},
                    677: 			$ENV{'form.creationdatestart_year'},
                    678: 			$ENV{'form.creationdateend_month'},
                    679: 			$ENV{'form.creationdateend_day'},
                    680: 			$ENV{'form.creationdateend_year'},
                    681: 			$ENV{'form.lastrevisiondatestart_month'},
                    682: 			$ENV{'form.lastrevisiondatestart_day'},
                    683: 			$ENV{'form.lastrevisiondatestart_year'},
                    684: 			$ENV{'form.lastrevisiondateend_month'},
                    685: 			$ENV{'form.lastrevisiondateend_day'},
                    686: 			$ENV{'form.lastrevisiondateend_year'},
                    687: 			);
1.90      harris41  688:     # Test to see if date windows are legitimate
1.61      harris41  689:     if ($datequery=~/^Incorrect/) {
                    690: 	&output_date_error($r,$datequery);
                    691: 	return OK;
                    692:     }
                    693:     elsif ($datequery) {
1.60      harris41  694: 	push @queries,$datequery;
                    695:     }
1.90      harris41  696: 
                    697:     # Process form information for custom metadata querying
1.76      harris41  698:     my $customquery='';
1.64      harris41  699:     if ($ENV{'form.custommetadata'}) {
                    700: 	$customquery=&build_custommetadata_query('custommetadata',
                    701: 				      $ENV{'form.custommetadata'});
                    702:     }
1.83      harris41  703:     my $customshow='';
                    704:     if ($ENV{'form.customshow'}) {
                    705: 	$customshow=$ENV{'form.customshow'};
                    706: 	$customshow=~s/[^\w\s]//g;
                    707: 	my @fields=split(/\s+/,$customshow);
                    708: 	$customshow=join(" ",@fields);
                    709:     }
1.90      harris41  710:     # Send query statements over the network to be processed by either the SQL
                    711:     # database or a recursive scheme of 'grep'-like actions (for custom
                    712:     # metadata).
1.45      harris41  713:     if (@queries) {
1.58      harris41  714: 	$query=join(" AND ",@queries);
1.46      harris41  715: 	$query="select * from metadata where $query";
1.90      harris41  716: 	my $reply; # reply hash reference
1.83      harris41  717: 	unless ($customquery or $customshow) {
1.76      harris41  718: 	    $reply=&Apache::lonnet::metadata_query($query);
                    719: 	}
                    720: 	else {
1.83      harris41  721: 	    $reply=&Apache::lonnet::metadata_query($query,
                    722: 						   $customquery,$customshow);
1.76      harris41  723: 	}
1.64      harris41  724: 	&output_results('Advanced',$r,$envhash,$customquery,$reply);
1.45      harris41  725:     }
1.86      harris41  726:     elsif ($customquery) {
1.90      harris41  727: 	my $reply; # reply hash reference
1.86      harris41  728: 	$reply=&Apache::lonnet::metadata_query('',
                    729: 					       $customquery,$customshow);
                    730: 	&output_results('Advanced',$r,$envhash,$customquery,$reply);
1.45      harris41  731:     }
1.92      harris41  732:     # should not get to this point
                    733:     return 'Error.  Should not have gone to this point.';
1.18      harris41  734: }
                    735: 
1.6       harris41  736: # --------------------------------------------------- Performing a basic search
                    737: sub basicsearch {
1.19      harris41  738:     my ($r,$envhash)=@_;
                    739:     my %ENV=%{$envhash};
1.64      harris41  740:     # Clean up fields for safety
                    741:     for my $field ('basicexp') {
                    742: 	$ENV{"form.$field"}=~s/[^\w\s\(\)\-]//g;
                    743:     }
                    744: 
1.90      harris41  745:     # Check to see if enough is filled in
1.26      harris41  746:     unless (&filled($ENV{'form.basicexp'})) {
1.24      harris41  747: 	&output_blank_field_error($r);
                    748: 	return OK;
                    749:     }
1.22      harris41  750: 
1.90      harris41  751:     # Build SQL query string based on form page
1.39      harris41  752:     my $query='';
1.33      harris41  753:     my $concatarg=join(',"    ",',
                    754: 		       ('title', 'author', 'subject', 'notes', 'abstract'));
1.95      harris41  755:     $concatarg='title' if $ENV{'form.titleonly'};
1.94      harris41  756: 
                    757:     $query=&build_SQL_query('concat('.$concatarg.')',$ENV{'form.'.'basicexp'});
                    758: 
1.90      harris41  759:     # Get reply (either a hash reference to filehandles or bad connection)
1.94      harris41  760:     my $reply=&Apache::lonnet::metadata_query('select * from metadata where '.$query);
1.90      harris41  761: 
                    762:     # Output search results
1.98      harris41  763: 
1.44      harris41  764:     &output_results('Basic',$r,$envhash,$query,$reply);
1.90      harris41  765: 
1.18      harris41  766:     return OK;
1.22      harris41  767: }
                    768: 
1.98      harris41  769: # ------------------------------------------------------------- build_SQL_query
                    770: sub build_SQL_query {
                    771:     my ($field_name,$logic_statement)=@_;
                    772:     my $q=new Text::Query('abc',
                    773: 			  -parse => 'Text::Query::ParseAdvanced',
                    774: 			  -build => 'Text::Query::Build');
                    775:     $q->prepare($logic_statement);
                    776:     my $matchexp=${$q}{'matchexp'}; chomp $matchexp;
                    777:     my $sql_query=&recursive_SQL_query_build($field_name,$matchexp);
                    778:     return $sql_query;
                    779: }
                    780: 
                    781: # ------------------------------------------------- build custom metadata query
                    782: sub build_custommetadata_query {
                    783:     my ($field_name,$logic_statement)=@_;
                    784:     my $q=new Text::Query('abc',
                    785: 			  -parse => 'Text::Query::ParseAdvanced',
                    786: 			  -build => 'Text::Query::BuildAdvancedString');
                    787:     $q->prepare($logic_statement);
                    788:     my $matchexp=${$q}{'-parse'}{'-build'}{'matchstring'};
                    789:     # quick fix to change literal into xml tag-matching
                    790:     # will eventually have to write a separate builder module
                    791:     my $oldmatchexp=$matchexp;
                    792:     $matchexp=~s/(\w+)\\\=([\w\\\+]+)/\\\<$1\\\>\[\^\\\<\]\*$2\[\^\\\<\]\*\\\<\\\/$1\\\>/g;
                    793:     return $matchexp;
                    794: }
                    795: 
                    796: # - Recursively parse a reverse notation expression into a SQL query expression
                    797: sub recursive_SQL_query_build {
                    798:     my ($dkey,$pattern)=@_;
                    799:     my @matches=($pattern=~/(\[[^\]|\[]*\])/g);
                    800:     return $pattern unless @matches;
                    801:     foreach my $match (@matches) {
                    802: 	$match=~/\[ (\w+)\s(.*) \]/;
                    803: 	my ($key,$value)=($1,$2);
                    804: 	my $replacement='';
                    805: 	if ($key eq 'literal') {
                    806: 	    $replacement="($dkey like \"\%$value\%\")";
                    807: 	}
                    808: 	elsif ($key eq 'not') {
                    809: 	    $value=~s/like/not like/;
                    810: #	    $replacement="($dkey not like $value)";
                    811: 	    $replacement="$value";
                    812: 	}
                    813: 	elsif ($key eq 'and') {
                    814: 	    $value=~/(.*[\"|\)]) ([|\(|\^].*)/;
                    815: 	    $replacement="($1 AND $2)";
                    816: 	}
                    817: 	elsif ($key eq 'or') {
                    818: 	    $value=~/(.*[\"|\)]) ([|\(|\^].*)/;
                    819: 	    $replacement="($1 OR $2)";
                    820: 	}
                    821: 	substr($pattern,
                    822: 	       index($pattern,$match),
                    823: 	       length($match),
                    824: 	       $replacement
                    825: 	       );
                    826:     }
                    827:     &recursive_SQL_query_build($dkey,$pattern);
                    828: }
1.22      harris41  829: 
1.98      harris41  830: # ------------------------------------------------------------ Build date query
                    831: sub build_date_queries {
                    832:     my ($cmonth1,$cday1,$cyear1,$cmonth2,$cday2,$cyear2,
                    833: 	$lmonth1,$lday1,$lyear1,$lmonth2,$lday2,$lyear2)=@_;
                    834:     my @queries;
                    835:     if ($cmonth1 or $cday1 or $cyear1 or $cmonth2 or $cday2 or $cyear2) {
                    836: 	unless ($cmonth1 and $cday1 and $cyear1 and
                    837: 		$cmonth2 and $cday2 and $cyear2) {
                    838: 	    return "Incorrect entry for the creation date.  You must specify ".
                    839: 		   "a starting month, day, and year and an ending month, ".
                    840: 		   "day, and year.";
                    841: 	}
                    842: 	my $cnumeric1=sprintf("%d%2d%2d",$cyear1,$cmonth1,$cday1);
                    843: 	$cnumeric1+=0;
                    844: 	my $cnumeric2=sprintf("%d%2d%2d",$cyear2,$cmonth2,$cday2);
                    845: 	$cnumeric2+=0;
                    846: 	if ($cnumeric1>$cnumeric2) {
                    847: 	    return "Incorrect entry for the creation date.  The starting ".
                    848: 		   "date must occur before the ending date.";
                    849: 	}
                    850: 	my $cquery="(creationdate BETWEEN '$cyear1-$cmonth1-$cday1' AND '".
                    851: 	           "$cyear2-$cmonth2-$cday2 23:59:59')";
                    852: 	push @queries,$cquery;
                    853:     }
                    854:     if ($lmonth1 or $lday1 or $lyear1 or $lmonth2 or $lday2 or $lyear2) {
                    855: 	unless ($lmonth1 and $lday1 and $lyear1 and
                    856: 		$lmonth2 and $lday2 and $lyear2) {
                    857: 	    return "Incorrect entry for the last revision date.  You must ".
                    858: 		   "specify a starting month, day, and year and an ending ".
                    859: 		   "month, day, and year.";
                    860: 	}
                    861: 	my $lnumeric1=sprintf("%d%2d%2d",$lyear1,$lmonth1,$lday1);
                    862: 	$lnumeric1+=0;
                    863: 	my $lnumeric2=sprintf("%d%2d%2d",$lyear2,$lmonth2,$lday2);
                    864: 	$lnumeric2+=0;
                    865: 	if ($lnumeric1>$lnumeric2) {
                    866: 	    return "Incorrect entry for the last revision date.  The ".
                    867: 		   "starting date must occur before the ending date.";
                    868: 	}
                    869: 	my $lquery="(lastrevisiondate BETWEEN '$lyear1-$lmonth1-$lday1' AND '".
                    870: 	           "$lyear2-$lmonth2-$lday2 23:59:59')";
                    871: 	push @queries,$lquery;
                    872:     }
                    873:     if (@queries) {
                    874: 	return join(" AND ",@queries);
                    875:     }
                    876:     return '';
1.18      harris41  877: }
1.6       harris41  878: 
1.18      harris41  879: # ----------------------------- format and output results based on a reply list
1.98      harris41  880: # There are two windows that this function writes to.  The main search
                    881: # window ("srch") has a listing of the results.  A secondary window ("popwin")
                    882: # gives the status of the network search (time elapsed, number of machines
                    883: # contacted, etc.)
1.18      harris41  884: sub output_results {
1.92      harris41  885:     my ($mode,$r,$envhash,$query,$replyref)=@_;
1.19      harris41  886:     my %ENV=%{$envhash};
1.92      harris41  887:     my %rhash=%{$replyref};
1.44      harris41  888:     my $compiledresult='';
1.92      harris41  889:     my $timeremain=30;
1.98      harris41  890:     my $elapsetime=0;
1.93      harris41  891:     my $resultflag=0;
                    892:     my $tflag=1;
                    893: 
                    894:     # make query information persistent to allow for subsequent revision
                    895:     my $persistent=&make_persistent();
                    896: 
                    897:     # output beginning of search page
1.92      harris41  898: 	$r->print(<<BEGINNING);
                    899: <html>
                    900: <head>
                    901: <title>The LearningOnline Network with CAPA</title>
                    902: BEGINNING
1.98      harris41  903: 
                    904:     # conditional output of script functions dependent on the mode in
                    905:     # which the search was invoked
1.92      harris41  906:         $r->print(<<SCRIPT) if $ENV{'form.catalogmode'} eq 'interactive';
                    907: <script>
                    908:     function select_data(title,url) {
                    909: 	changeTitle(title);
                    910: 	changeURL(url);
1.97      harris41  911: 	self.close();
1.92      harris41  912:     }
                    913:     function changeTitle(val) {
                    914: 	if (opener.inf.document.forms.resinfo.elements.t) {
                    915: 	    opener.inf.document.forms.resinfo.elements.t.value=val;
                    916: 	}
                    917:     }
                    918:     function changeURL(val) {
                    919: 	if (opener.inf.document.forms.resinfo.elements.u) {
                    920: 	    opener.inf.document.forms.resinfo.elements.u.value=val;
                    921: 	}
                    922:     }
                    923: </script>
                    924: SCRIPT
1.98      harris41  925:         $r->print(<<SCRIPT) if $ENV{'form.catalogmode'} eq 'groupsearch';
                    926: <script>
                    927:     function select_data(title,url) {
                    928: 	alert('DEBUG: Should be storing '+title+' and '+url);
                    929:     }
                    930:     function queue(val) {
                    931: 	if (eval("document.forms."+val+".filelink.checked")) {
                    932: 	    document.forms.results.acts.value+='1a'+val+'b';
                    933: 	}
                    934: 	else {
                    935: 	    document.forms.results.acts.value+='0a'+val+'b';
                    936: 	}
                    937:     }
                    938:     function select_group() {
                    939: 	alert('DEBUG: Should be moving on to group sorting stage'+' acts');
                    940:     }
                    941: </script>
                    942: SCRIPT
                    943:         $r->print(<<SCRIPT);                                            ;
                    944: <script>
                    945:     function displayinfo(val) {
                    946: 	popwin.document.forms.popremain.sdetails.value=val;
                    947:     }
                    948: </script>
                    949: SCRIPT
                    950:     $r->rflush();
                    951: 
                    952:     # begin showing the cataloged results
1.92      harris41  953:     $r->print(<<CATALOGBEGIN);
                    954: </head>
                    955: <body bgcolor="#ffffff">
                    956: <img align=right src=/adm/lonIcons/lonlogos.gif>
                    957: <h1>Search Catalog</h1>
                    958: CATALOGBEGIN
1.98      harris41  959:         $r->print(<<CATALOGCONTROLS);
                    960: <form name='results' method="post" action="/adm/searchcat">
                    961: <input type='hidden' name='acts' value='' />
1.93      harris41  962: <input type='button' value='Revise search request'
1.98      harris41  963: onClick='this.form.submit();' />
                    964: $importbutton
1.93      harris41  965: $closebutton
                    966: $persistent
1.98      harris41  967: <hr />
1.93      harris41  968: <h3>Search Query</h3>
1.98      harris41  969: CATALOGCONTROLS
1.93      harris41  970:     if ($mode eq 'Basic') {
                    971: 	$r->print(<<RESULTS);
                    972: <p>
                    973: <b>Basic search:</b> $ENV{'form.basicexp'}
                    974: </p>
                    975: RESULTS
                    976:     }
                    977:     elsif ($mode eq 'Advanced') {
                    978: 	$r->print(<<RESULTS);
                    979: <p>
                    980: <b>Advanced search</b>
                    981: $query
                    982: </p>
                    983: RESULTS
                    984:     }
                    985:     $r->print('<h3>Search Results</h3>');
1.92      harris41  986:     $r->rflush();
1.98      harris41  987:     my $servernum=(keys %rhash)+0;
                    988: 
                    989:     # define server grid (shows status of multiple machines)
                    990:     my $hcinit;
                    991:     my $grid="'<br />'+";
                    992:     $grid.="\n";
                    993:     my $sn=1;
                    994:     for my $sk (sort keys %rhash) {
                    995: 	# '<a href="
                    996: 	$grid.="'<a href=\"";
                    997: 	# javascript:displayinfo('+
                    998: 	$grid.="javascript:opener.displayinfo('+";
                    999: 	# "'"+'key
                   1000: 	$grid.="\"'\"+'";
1.99    ! harris41 1001: 	$grid.=$sk;
1.98      harris41 1002: 	my $hc;
                   1003: 	if ($rhash{$sk} eq 'con_lost') {
                   1004: 	    $hc="!!!BAD CONNECTION, CONTACT SYSTEM ADMINISTRATOR!!!";
                   1005: 	}
                   1006: 	else {
                   1007: 	    $hc="'+\"'\"+\"+hc['$sk']+\"+\"'\"+'";
1.99    ! harris41 1008: 	    $hcinit.="hc[\"$sk\"]=\"not yet connected...\";";
1.98      harris41 1009: 	}
                   1010: 	$grid.=" hitcount=".$hc;
1.99    ! harris41 1011: 	$grid.=" domain=".$hostdomains{$sk};
1.98      harris41 1012: 	$grid.=" IP=".$hostips{$sk};
                   1013: 	# '+"'"+'">'+
                   1014: 	$grid.="'+\"'\"+')\">'+";
                   1015: 	$grid.="\n";
                   1016: 	$grid.="'<img border=\"0\" name=\"img".$sn."\"".
1.99    ! harris41 1017: 	    " src=\"/adm/lonIcons/srvnull.gif\" alt=\"".$sk."\" /></a>'+\n";
1.98      harris41 1018: 	$grid.="'<br />'+\n" unless $sn%10;
                   1019:         $sn++;
                   1020:     }
1.92      harris41 1021: 	    $r->print(<<ENDPOP);
                   1022: <script>
1.98      harris41 1023:     popwin=open('','popwin','scrollbars=1,width=400,height=200');
                   1024:     popwin.focus();
                   1025:     popwin.document.writeln('<'+'html>');
                   1026:     popwin.document.writeln('<'+'head>');
                   1027:     popwin.document.writeln('<'+'script>');
                   1028:     popwin.document.writeln('hc=new Array();$hcinit');
                   1029:     popwin.document.writeln('<'+'/script>');
                   1030:     popwin.document.writeln('<'+'/head>'+
                   1031:         '<'+'body bgcolor="#FFFFFF">'+
1.99    ! harris41 1032: 	'<'+'image align="right" src="/adm/lonIcons/'+
        !          1033: 	'lonanim.gif" '+
        !          1034: 	'alt="animated logo" />'+
1.98      harris41 1035: 	'<'+'h3>Search Results Progress<'+'/h3>'+
                   1036:         '<'+'form name="popremain">'+
                   1037:         '<'+'tt>'+
1.99    ! harris41 1038: 	'<'+'br clear="all"/><i>PLEASE BE PATIENT</i>'+
1.98      harris41 1039: 	'<'+'br />SCANNING $servernum SERVERS'+
                   1040: 	'<'+'br clear="all" />Number of record hits found '+
                   1041: 	'<'+'input type="text" size="10" name="numhits"'+
                   1042: 	' value="0" />'+
                   1043: 	'<'+'br clear="all" />Time elapsed '+
                   1044: 	'<'+'input type="text" size="10" name="elapsetime"'+
                   1045: 	' value="0" />'+
                   1046: 	'<'+'br />'+
                   1047: 	'SERVER GRID (click on any cell for details)'+
                   1048:         $grid
                   1049:         '<'+'br />'+
                   1050: 	'Server details '+
                   1051: 	'<'+'input type="text" size="25" name="sdetails"'+
                   1052: 	' value="" />'+
                   1053: 	'<'+'br />'+
                   1054: 	'<'+'input type="button" name="button"'+
                   1055: 	' value="revise search" />'+
                   1056: 	' <'+'input type="button" name="button"'+
                   1057: 	' value="view results" />'+
                   1058: 	' <'+'input type="button" name="button"'+
                   1059: 	' value="help" />'+
                   1060: 	'<'+'/tt>'+
                   1061:         '<'+'/form>'+
                   1062:         '<'+'/body><'+'/html>');
1.92      harris41 1063:     popwin.document.close();
                   1064: </script>
                   1065: ENDPOP
                   1066:     $r->rflush();
1.44      harris41 1067: 
1.93      harris41 1068:     my $servercount=0;
1.98      harris41 1069:     $sn=0;
                   1070:     my $hitcountsum=0;
                   1071:     foreach my $rkey (sort keys %rhash) {
                   1072: 	$sn++;
1.93      harris41 1073: 	$servercount++;
                   1074: 	$tflag=1;
                   1075: 	$compiledresult='';
                   1076: 	my $hostname=$rkey;
1.92      harris41 1077: 	my $reply=$rhash{$rkey};
1.18      harris41 1078: 	my @results;
1.92      harris41 1079: 	
1.18      harris41 1080: 	my $replyfile='';
1.93      harris41 1081: 
                   1082: 	if ($reply eq 'con_lost') {
1.99    ! harris41 1083: 	    $r->print('<script>popwin.document.img'.$sn.'.'.
        !          1084: 		      'src="/adm/lonIcons/srvbad.gif";</script>'.
        !          1085: 		      "\n");
        !          1086: 	    $r->rflush();
1.93      harris41 1087: 	}
                   1088: 	else {
                   1089: 	    $reply=~/^([\.\w]+)$/; # must do since 'use strict' checks for tainting
                   1090: 	    $replyfile=$r->dir_config('lonDaemons').'/tmp/'.$1;
                   1091: 	    $reply=~/(.*?)\_/;
                   1092: 	    {
1.98      harris41 1093: 		my $temp=0;
                   1094: 	      WLOOP: while (1) {
                   1095: 		  if (-e $replyfile && $tflag) {
1.99    ! harris41 1096: 		      $r->print('<script>popwin.document.img'.$sn.'.'.
        !          1097: 				'src="/adm/lonIcons/srvhalf.gif";</script>'.
1.98      harris41 1098: 				"\n");
                   1099: 		      $r->rflush();
1.99    ! harris41 1100: 		      $r->print('<script>popwin.hc["'.$rkey.'"]='.
        !          1101: 				'"still transferring..."'.';</script>'.
1.98      harris41 1102: 				"\n");
                   1103: 		      $r->rflush();
                   1104: 		      $tflag=0;
                   1105: 		  }
                   1106: 		  last WLOOP if $temp>5;
                   1107: 		  if (-e "$replyfile.end") {
                   1108: 		      if (-s $replyfile) {
                   1109: 			  $r->print('<script>popwin.document.img'.$sn.'.'.
                   1110: 				'src="/adm/lonIcons/srvgood.gif";</script>'.
                   1111: 				"\n");
                   1112: 			  $r->rflush();
                   1113: 			  my $fh=Apache::File->new($replyfile) or 
                   1114: 			      ($r->print('ERROR: file '.
                   1115: 					 $replyfile.' cannot be opened') and
                   1116: 			       return OK);
                   1117: 			  @results=<$fh> if $fh;
                   1118: 			  $hitcount{$rkey}=@results+0;
                   1119: 			  $r->print('<script>popwin.hc["'.$rkey.'"]='.
                   1120: 				    $hitcount{$rkey}.';</script>'.
                   1121: 				    "\n");
                   1122: 			  $r->rflush();
                   1123: 			  $hitcountsum+=$hitcount{$rkey};
                   1124: 			  $r->print('<script>popwin.document.forms.popremain.'.
                   1125: 				    'numhits.value='.$hitcountsum.
                   1126: 				    ';</script>'.
                   1127: 				    "\n");
                   1128: 			  $r->rflush();
                   1129: 		      }
1.99    ! harris41 1130: 		      else {
        !          1131: 			  $r->print('<script>popwin.document.img'.$sn.'.'.
        !          1132: 				'src="/adm/lonIcons/srvempty.gif";</script>'.
        !          1133: 				"\n");
        !          1134: 			  $r->rflush();
        !          1135: 			  $r->print('<script>popwin.hc["'.$rkey.'"]=0'.
        !          1136: 				    ';</script>'.
        !          1137: 				    "\n");
        !          1138: 			  $r->rflush();
        !          1139: 		      }
1.98      harris41 1140: 		      last WLOOP;
                   1141: 		  }
                   1142: 		  last WLOOP unless $timeremain;
                   1143: 		  sleep 1;
                   1144: 		  $timeremain--;
                   1145: 		  $elapsetime++;
                   1146: 		  $r->print('<script>popwin.document.popremain.elapsetime.'.
                   1147: 			    'value="'.$elapsetime.'";</script>'."\n");
                   1148: 		  $r->rflush();
                   1149: 		  $temp++;
                   1150: 	      }
1.93      harris41 1151: 	    }
1.6       harris41 1152: 	}
1.77      harris41 1153: 	my $customshow='';
                   1154: 	my $extrashow='';
1.87      harris41 1155: 	my @customfields;
1.77      harris41 1156: 	if ($ENV{'form.customshow'}) {
                   1157: 	    $customshow=$ENV{'form.customshow'};
                   1158: 	    $customshow=~s/[^\w\s]//g;
1.87      harris41 1159: 	    my @fields=map {"<font color=\"#008000\">$_:</font><!-- $_ -->"} 
1.93      harris41 1160: 	    split(/\s+/,$customshow);
1.88      harris41 1161: 	    @customfields=split(/\s+/,$customshow);
1.81      harris41 1162: 	    if ($customshow) {
                   1163: 		$extrashow="<ul><li>".join("</li><li>",@fields)."</li></ul>\n";
                   1164: 	    }
1.77      harris41 1165: 	}
1.79      harris41 1166: 	my $customdata='';
1.87      harris41 1167: 	my %customhash;
1.79      harris41 1168: 	foreach my $result (@results) {
1.82      harris41 1169: 	    if ($result=~/^(custom\=.*)$/) { # grab all custom metadata
1.87      harris41 1170: 		my $tmp=$result;
                   1171: 		$tmp=~s/^custom\=//;
                   1172: 		my ($k,$v)=map {&Apache::lonnet::unescape($_);
                   1173: 			    } split(/\,/,$tmp);
                   1174: 		$customhash{$k}=$v;
1.82      harris41 1175: 	    }
1.79      harris41 1176: 	}
1.18      harris41 1177: 	foreach my $result (@results) {
1.82      harris41 1178: 	    next if $result=~/^custom\=/;
                   1179: 	    chomp $result;
1.85      harris41 1180: 	    next unless $result;
1.50      harris41 1181: 	    my @fields=map
1.93      harris41 1182: 	    {&Apache::lonnet::unescape($_)}
                   1183: 	    (split(/\,/,$result));
1.18      harris41 1184: 	    my ($title,$author,$subject,$url,$keywords,$version,
                   1185: 		$notes,$abstract,$mime,$lang,
1.50      harris41 1186: 		$creationdate,$lastrevisiondate,$owner,$copyright)=@fields;
1.18      harris41 1187: 	    my $shortabstract=$abstract;
                   1188: 	    $shortabstract=substr($abstract,0,200) if length($abstract)>200;
1.51      harris41 1189: 	    $fields[7]=$shortabstract;
1.87      harris41 1190: 	    my $extrashow2=$extrashow;
                   1191: 	    if ($extrashow) {
                   1192: 		foreach my $field (@customfields) {
                   1193: 		    my $value='';
                   1194: 		    if ($customhash{$url}=~/\<${field}[^\>]*\>(.*?)\<\/${field}[^\>]*\>/s) {
1.93      harris41 1195: 		        $value=$1;
1.87      harris41 1196: 		    }
1.93      harris41 1197: 	            $extrashow2=~s/\<\!\-\- $field \-\-\>/ $value/g;
                   1198: 	        }
                   1199:             }
                   1200: 	
1.98      harris41 1201:             $compiledresult.=<<END if $compiledresult or $servercount!=$servernum;
1.89      harris41 1202: <hr align='left' width='200' noshade />
                   1203: END
1.93      harris41 1204:             $compiledresult.=<<END;
1.56      harris41 1205: <p>
1.8       harris41 1206: END
1.93      harris41 1207:             $compiledresult.=<<END if $ENV{'form.catalogmode'} eq 'interactive';
1.8       harris41 1208: <font size='-1'><INPUT TYPE="button" NAME="returnvalues" VALUE="SELECT"
1.10      harris41 1209: onClick="javascript:select_data('$title','$url')">
1.8       harris41 1210: </font>
1.98      harris41 1211: <br />
                   1212: END
                   1213:             $compiledresult.=<<END if $ENV{'form.catalogmode'} eq 'groupsearch';
                   1214: <font size='-1'><input type="checkbox" name="returnvalues" value="SELECT"
                   1215: onClick="javascript:queue($fnum)" />
                   1216: </font>
                   1217: <input type="hidden" name="title$fnum" value="$title" />
                   1218: <input type="hidden" name="url$fnum" value="$url" />
                   1219: <br />
1.8       harris41 1220: END
1.51      harris41 1221:             my $httphost=$ENV{'HTTP_HOST'};
1.53      harris41 1222: 
1.93      harris41 1223:             my $viewselect;
                   1224:             if ($mode eq 'Basic') {
1.55      harris41 1225: 		$viewselect=$ENV{'form.basicviewselect'};
                   1226: 	    }
1.93      harris41 1227:             elsif ($mode eq 'Advanced') {
                   1228: 	        $viewselect=$ENV{'form.advancedviewselect'};
                   1229:             }
1.55      harris41 1230: 
                   1231:             if ($viewselect eq 'Detailed Citation View') {
1.93      harris41 1232: 	        $compiledresult.=&detailed_citation_view(@fields,
                   1233: 						 $hostname,$httphost,
                   1234: 						 $extrashow2);
1.50      harris41 1235: 	    }
1.55      harris41 1236:             elsif ($viewselect eq 'Summary View') {
1.77      harris41 1237: 		$compiledresult.=&summary_view(@fields,$hostname,$httphost,
1.93      harris41 1238: 				       $extrashow2);
1.50      harris41 1239: 	    }
1.55      harris41 1240:             elsif ($viewselect eq 'Fielded Format') {
1.51      harris41 1241: 		$compiledresult.=&fielded_format_view(@fields,$hostname,
1.93      harris41 1242: 					      $httphost,$extrashow2);
1.50      harris41 1243: 	    }
1.55      harris41 1244:             elsif ($viewselect eq 'XML/SGML') {
1.77      harris41 1245: 		$compiledresult.=&xml_sgml_view(@fields,$hostname,$httphost,
1.93      harris41 1246: 					$extrashow2);
1.50      harris41 1247: 	    }
1.93      harris41 1248:     
1.18      harris41 1249:         }
1.6       harris41 1250: 
1.93      harris41 1251: 	if ($compiledresult) {
                   1252: 	    $resultflag=1;
1.18      harris41 1253: 	}
1.6       harris41 1254: 
1.43      harris41 1255: 	$r->print(<<RESULTS);
1.93      harris41 1256: $compiledresult
1.43      harris41 1257: RESULTS
1.93      harris41 1258:         my $percent=sprintf('%3.0f',($servercount/$servernum*100));
1.44      harris41 1259:     }
1.93      harris41 1260:     unless ($resultflag) {
                   1261:         $r->print("\nThere were no results that matched your query\n");
1.43      harris41 1262:     }
1.98      harris41 1263: #    $r->print('<script>popwin.close()</script>'."\n"); $r->rflush(); 
1.93      harris41 1264:     $r->print(<<RESULTS);
1.6       harris41 1265: </body>
                   1266: </html>
                   1267: RESULTS
1.41      harris41 1268: }
                   1269: 
1.50      harris41 1270: # ------------------------------------------------------ Detailed Citation View
                   1271: sub detailed_citation_view {
                   1272:     my ($title,$author,$subject,$url,$keywords,$version,
1.51      harris41 1273: 	$notes,$shortabstract,$mime,$lang,
                   1274: 	$creationdate,$lastrevisiondate,$owner,$copyright,
1.77      harris41 1275: 	$hostname,$httphost,$extrashow)=@_;
1.50      harris41 1276:     my $result=<<END;
1.56      harris41 1277: <i>$owner</i>, last revised $lastrevisiondate
                   1278: <h3><A HREF="http://$httphost$url" TARGET='search_preview'>$title</A></h3>
                   1279: <h3>$author</h3>
                   1280: </p>
                   1281: <p>
1.98      harris41 1282: <b>Subject:</b> $subject<br />
                   1283: <b>Keyword(s):</b> $keywords<br />
                   1284: <b>Notes:</b> $notes<br />
                   1285: <b>MIME Type:</b> $mimetag{$mime}<br />
                   1286: <b>Language:</b> $language{$lang}<br />
                   1287: <b>Copyright/Distribution:</b> $cprtag{$copyright}<br />
1.78      harris41 1288: </p>
1.77      harris41 1289: $extrashow
1.78      harris41 1290: <p>
1.56      harris41 1291: $shortabstract
1.50      harris41 1292: </p>
                   1293: END
                   1294:     return $result;
                   1295: }
                   1296: 
                   1297: # ---------------------------------------------------------------- Summary View
                   1298: sub summary_view {
                   1299:     my ($title,$author,$subject,$url,$keywords,$version,
1.51      harris41 1300: 	$notes,$shortabstract,$mime,$lang,
                   1301: 	$creationdate,$lastrevisiondate,$owner,$copyright,
1.77      harris41 1302: 	$hostname,$httphost,$extrashow)=@_;
1.50      harris41 1303:     my $result=<<END;
1.56      harris41 1304: <a href="http://$httphost$url" TARGET='search_preview'>$author</a><br />
                   1305: $title<br />
                   1306: $owner -- $lastrevisiondate<br />
                   1307: $cprtag{$copyright}<br />
1.77      harris41 1308: $extrashow
1.50      harris41 1309: </p>
                   1310: END
                   1311:     return $result;
                   1312: }
                   1313: 
                   1314: # -------------------------------------------------------------- Fielded Format
                   1315: sub fielded_format_view {
                   1316:     my ($title,$author,$subject,$url,$keywords,$version,
1.51      harris41 1317: 	$notes,$shortabstract,$mime,$lang,
                   1318: 	$creationdate,$lastrevisiondate,$owner,$copyright,
1.77      harris41 1319: 	$hostname,$httphost,$extrashow)=@_;
1.50      harris41 1320:     my $result=<<END;
1.51      harris41 1321: <b>URL: </b> <A HREF="http://$httphost$url" TARGET='search_preview'>$url</A>
1.56      harris41 1322: <br />
                   1323: <b>Title:</b> $title<br />
                   1324: <b>Author(s):</b> $author<br />
                   1325: <b>Subject:</b> $subject<br />
                   1326: <b>Keyword(s):</b> $keywords<br />
                   1327: <b>Notes:</b> $notes<br />
                   1328: <b>MIME Type:</b> $mimetag{$mime}<br />
                   1329: <b>Language:</b> $language{$lang}<br />
                   1330: <b>Creation Date:</b> $creationdate<br />
                   1331: <b>Last Revision Date:</b> $lastrevisiondate<br />
                   1332: <b>Publisher/Owner:</b> $owner<br />
                   1333: <b>Copyright/Distribution:</b> $cprtag{$copyright}<br />
                   1334: <b>Repository Location:</b> $hostname<br />
                   1335: <b>Abstract:</b> $shortabstract<br />
1.77      harris41 1336: $extrashow
1.50      harris41 1337: </p>
                   1338: END
                   1339:     return $result;
                   1340: }
                   1341: 
                   1342: # -------------------------------------------------------------------- XML/SGML
                   1343: sub xml_sgml_view {
                   1344:     my ($title,$author,$subject,$url,$keywords,$version,
1.51      harris41 1345: 	$notes,$shortabstract,$mime,$lang,
                   1346: 	$creationdate,$lastrevisiondate,$owner,$copyright,
1.77      harris41 1347: 	$hostname,$httphost,$extrashow)=@_;
1.50      harris41 1348:     my $result=<<END;
1.56      harris41 1349: <pre>
                   1350: &lt;LonCapaResource&gt;
1.57      harris41 1351: &lt;url&gt;$url&lt;/url&gt;
1.56      harris41 1352: &lt;title&gt;$title&lt;/title&gt;
                   1353: &lt;author&gt;$author&lt;/author&gt;
                   1354: &lt;subject&gt;$subject&lt;/subject&gt;
                   1355: &lt;keywords&gt;$keywords&lt;/keywords&gt;
                   1356: &lt;notes&gt;$notes&lt;/notes&gt;
                   1357: &lt;mimeInfo&gt;
                   1358: &lt;mime&gt;$mime&lt;/mime&gt;
                   1359: &lt;mimetag&gt;$mimetag{$mime}&lt;/mimetag&gt;
                   1360: &lt;/mimeInfo&gt;
                   1361: &lt;languageInfo&gt;
                   1362: &lt;language&gt;$lang&lt;/language&gt;
                   1363: &lt;languagetag&gt;$language{$lang}&lt;/languagetag&gt;
                   1364: &lt;/languageInfo&gt;
                   1365: &lt;creationdate&gt;$creationdate&lt;/creationdate&gt;
                   1366: &lt;lastrevisiondate&gt;$lastrevisiondate&lt;/lastrevisiondate&gt;
                   1367: &lt;owner&gt;$owner&lt;/owner&gt;
                   1368: &lt;copyrightInfo&gt;
                   1369: &lt;copyright&gt;$copyright&lt;/copyright&gt;
                   1370: &lt;copyrighttag&gt;$cprtag{$copyright}&lt;/copyrighttag&gt;
                   1371: &lt;/copyrightInfo&gt;
                   1372: &lt;repositoryLocation&gt;$hostname&lt;/repositoryLocation&gt;
                   1373: &lt;shortabstract&gt;$shortabstract&lt;/shortabstract&gt;
1.57      harris41 1374: &lt;/LonCapaResource&gt;
1.56      harris41 1375: </pre>
1.77      harris41 1376: $extrashow
1.50      harris41 1377: END
                   1378:     return $result;
1.60      harris41 1379: }
                   1380: 
1.98      harris41 1381: # ---------------------------------------------------- see if a field is filled
                   1382: sub filled {
                   1383:     my ($field)=@_;
                   1384:     if ($field=~/\S/ && $field ne 'any') {
                   1385: 	return 1;
1.61      harris41 1386:     }
1.98      harris41 1387:     else {
                   1388: 	return 0;
1.61      harris41 1389:     }
1.60      harris41 1390: }
                   1391: 
1.98      harris41 1392: # ---------------- Message to output when there are not enough fields filled in
                   1393: sub output_blank_field_error {
                   1394:     my ($r)=@_;
                   1395:     # make query information persistent to allow for subsequent revision
                   1396:     my $persistent=&make_persistent();
                   1397: 
                   1398:     $r->print(<<BEGINNING);
                   1399: <html>
                   1400: <head>
                   1401: <title>The LearningOnline Network with CAPA</title>
                   1402: BEGINNING
                   1403:     $r->print(<<RESULTS);
                   1404: </head>
                   1405: <body bgcolor="#ffffff">
                   1406: <img align='right' src='/adm/lonIcons/lonlogos.gif' />
                   1407: <h1>Search Catalog</h1>
                   1408: <form method="post" action="/adm/searchcat">
                   1409: $persistent
                   1410: <input type='button' value='Revise search request'
                   1411: onClick='this.form.submit();' />
                   1412: $closebutton
                   1413: <hr />
                   1414: <h3>Helpful Message</h3>
                   1415: <p>
                   1416: Incorrect search query due to blank entry fields.
                   1417: You need to fill in the relevant
                   1418: fields on the search page in order for a query to be
                   1419: processed.
                   1420: </p>
                   1421: </body>
                   1422: </html>
                   1423: RESULTS
                   1424: }
                   1425: 
                   1426: # ----------------------------------------------------------- Output date error
1.60      harris41 1427: sub output_date_error {
                   1428:     my ($r,$message)=@_;
                   1429:     # make query information persistent to allow for subsequent revision
1.65      harris41 1430:     my $persistent=&make_persistent();
1.60      harris41 1431: 
                   1432:     $r->print(<<BEGINNING);
                   1433: <html>
                   1434: <head>
                   1435: <title>The LearningOnline Network with CAPA</title>
                   1436: BEGINNING
                   1437:     $r->print(<<RESULTS);
                   1438: </head>
                   1439: <body bgcolor="#ffffff">
1.98      harris41 1440: <img align='right' src='/adm/lonIcons/lonlogos.gif' />
1.60      harris41 1441: <h1>Search Catalog</h1>
                   1442: <form method="post" action="/adm/searchcat">
                   1443: $persistent
                   1444: <input type='button' value='Revise search request'
1.98      harris41 1445: onClick='this.form.submit();' />
1.60      harris41 1446: $closebutton
1.98      harris41 1447: <hr />
1.60      harris41 1448: <h3>Helpful Message</h3>
                   1449: <p>
                   1450: $message
                   1451: </p>
                   1452: </body>
                   1453: </html>
                   1454: RESULTS
1.3       harris41 1455: }
1.1       www      1456: 
                   1457: 1;
1.98      harris41 1458: 
1.1       www      1459: __END__

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>