<?vsp 
--  
--  $Id$
--  
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--  
--  Copyright (C) 1998-2012 OpenLink Software
--  
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--  
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--  
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--  
--  

  adm_pre_page(lines);

  declare _stmt, _group varchar;
  declare _maxres integer;
  declare inx integer;
  declare _u_id integer;
  declare _sid_id, _own varchar;
  declare _group_match varchar;
  declare msg_date, usr_date date;
  declare user_d, user_m, user_y, chois varchar;

  _u_id := DB.DBA.adm_dav_check_auth (lines, 1);
  if (_u_id < 1)
    {
      http_request_status ('HTTP/1.1 401 Unauthorized');
      http ( concat ('<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">',
	    '<HTML><HEAD>',
	    '<TITLE>401 Unauthorized</TITLE>',
	    '</HEAD><BODY><H1>Unauthorized</H1>',
            'Access to page is forbidden.</BODY></HTML>'));
      return (0);
    }

  _sid_id := adm_get_sesid (params);

 _group_match := get_keyword ('group', params, '');
 user_d := get_keyword ('date_d', params);
 user_m := get_keyword ('date_m', params);
 user_y := get_keyword ('date_y', params);
 usr_date := NULL;

  _own := coalesce ((select U_NAME from WS.WS.SYS_DAV_USER where U_ID = _u_id), '');

  if (not is_empty_or_null (get_keyword ('reset', params)))
    {
      _maxres := 100;
      _stmt := '';
      _group_match := get_keyword ('group', params, '');
      user_d := '';
      user_m := '';
      user_y := '';
      usr_date := '';
    }
  else
    {
      _maxres := atoi (get_keyword ('maxres', params, '500'));
      _stmt := get_keyword ('stmt', params, '');
    }
?>

<html>
  <head>
    <link rel="stylesheet" type="text/css" href="<?=adm_what_css()?>">
    <meta name="AUTHOR" content="OpenLink Software">
    <meta name="DESCRIPTION" content="Interactive text search using Virtuoso VSP">
    <title>Internet News Search</title>
  </head>
<?vsp adm_page_header('Internet News Text Search', 'newstextsearch'); ?>

<P>Type the words or phrases (contained in double quotes) separated by
<STRONG>AND</STRONG> or <STRONG>OR</STRONG> keywords into the text area provided that you wish to search the messages in News groups for.
	</P>
	<P>Press the <STRONG>Execute</STRONG> button to fetch the results of the search.</P>
	<P>The results will be returned as a hyper-linked list of search hits.  Press on the links to go to the document.</P>

<P>Please use double quotes around phrases with alphanumeric characters.</P>

    <TABLE CLASS="genlist" BORDER="0" CELLPADDING="0">
    <FORM name="main_form" method="POST" action="news_search_result.vsp">
    <INPUT type=hidden name=sid value="<?=_sid_id?>">
     <TR><TD CLASS="genhead">Internet news Search</TD></TR>
		<TR><TD CLASS="AdmBorders"><IMG SRC="../admin/images/1x1.gif" WIDTH="1" HEIGHT="2" ALT=""></TD></TR>
	    <TR><TD CLASS="genlistheadt">Search Expression</TD></TR>
	    <TR><TD><textarea name="stmt" rows="5" cols="60"><?= coalesce(_stmt, '') ?></textarea></TD></TR>
		<TR><TD>
	<TABLE BORDER="0" WIDTH="100%">
		<TR><TD COLSPAN="2"><IMG SRC="../admin/images/1x1.gif" WIDTH="1" HEIGHT="15" ALT=""></TD></TR>
           <TR>
             <TD CLASS="genlisthead" ALIGN="right">
	     <SELECT NAME="chois">
		<OPTION VALUE="new" SELECTED>Newer than</OPTION>
		<OPTION VALUE="old">Older than</OPTION>
		<OPTION VALUE="exact">Exactly</OPTION>
	     </SELECT> (MM/DD/YYYY)</TD>
	     <TD>
	       <INPUT TYPE="text" NAME="date_m" value="<?=user_m?>" size="2">/
	       <INPUT TYPE="text" NAME="date_d" value="<?=user_d?>" size="2">/
	       <INPUT TYPE="text" NAME="date_y" value="<?=user_y?>" size="4"></TD></TR>
	      <TR><TD CLASS="genlisthead" NOWRAP>Newsgroup match</TD>
	      <TD>
	       <INPUT TYPE="text" NAME="group" value="<?=_group_match?>"></TD></TR>
	      <TR><TD COLSPAN="2" ALIGN="right"><INPUT TYPE="submit" NAME="xecute" VALUE="Search"></TD></FORM>
	      <TD><FORM name="main_form" method="POST" action="news_search.vsp">
            <TD ALIGN="right"><INPUT TYPE="submit" NAME="reset" VALUE="Reset"></TD></FORM></TR>

       </TABLE>
    </TABLE>

<?vsp adm_page_footer(); ?>
</html>

