Index: lib/marine/step1.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/marine/step1.png
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/marine/marine.xsl
===================================================================
--- lib/marine/marine.xsl	(revision 303)
+++ lib/marine/marine.xsl	(revision 304)
@@ -7,7 +7,7 @@
   *               National Center for Ecological Analysis and Synthesis
   *  For Details: http://www.nceas.ucsb.edu/
   *      Created: 2000 July 20
-  *    File Info: '$Id$'
+  *    File Info: '$Id$' 
   *
   * This is an XSLT (http://www.w3.org/TR/xslt) stylesheet designed to
   * convert an XML file showing the resultset of a query
@@ -24,56 +24,194 @@
 	<link rel="stylesheet" type="text/css" href="/xmltodb/lib/rowcol.css" />
       </head>
       <body class="emlbody">
-      
-      	<form action="http://alpha.nceas.ucsb.edu/servlets/marineServlet" 
+        <a name="top" />
+        <center><h1>MARINE Query Interface</h1></center>
+        
+        <p><h3>You can either <a href="#browse">browse the database</a> or start with 
+           step 1 below.</h3></p>
+        
+        <table width="100%" border="1">
+          <tr>
+             <td valign="bottom">
+        	<img src="http://alpha.nceas.ucsb.edu/xmltodb/lib/marine/step1.png" />
+        	<p>Enter data about the owner of the dataset.  There may be more than one
+        	   owner of any given dataset.  Any field(s) left blank will not be used
+        	   in the search criteria.
+        	</p>
+              </td>
+          </tr>
+        </table>
+             
+      	<form action="http://alpha.nceas.ucsb.edu/servlets/marineServlet#browse" 
               method="POST"> 
            <table width="100%">
              <tr>
                 <td>First Name:</td>
-                <td>Organization:</td>
-                <td>Address:</td>
-                <td>Postal Code:</td>
+                <td><input type="text" name="given_name" /></td>
+                <td>Last Name:</td>
+                <td><input type="text" name="surname" /></td>
              </tr>
              <tr>
-             	<td><input type="text" name="given_name"></td>
-             	<td><input type="text" name="organization"></td>
-             	<td><input type="text" name="deliveryPoint"></td>
-             	<td><input type="text" name="postalCode"></td>
-             </td>
+             	<td>Organization:</td>
+             	<td><input type="text" name="organization" /></td>
+             	<td>Address:</td>
+             	<td><input type="text" name="deliveryPoint" /></td>
+             </tr>
              <tr>
-             	<td>Last Name:</td>
+             	<td>City:</td>
+             	<td><input type="text" name="city" /></td>
+             	<td>Postal Code:</td>
+             	<td><input type="text" name="postalCode" /></td>
+             </tr>
+             <tr>
              	<td>Email Address:</td>
-             	<td>City:</td>
+             	<td><input type="text" name="electronicMailAddress" /></td>
              	<td>Phone:</td>
+             	<td><input type="text" name="voice" /></td>
              </tr>
+           </table>
+        
+        <table width="100%" border="1">
+          <tr>
+             <td valign="bottom">
+        	<img src="http://alpha.nceas.ucsb.edu/xmltodb/lib/marine/step2.png" />
+        	<p>Enter bibliographic data relevent to the dataset.  
+        	   Any field(s) left blank will not be used in the search criteria.  
+        	   Some fields might not be relevent to the dataset for which you are 
+        	   searching.
+        	</p>
+             </td>
+          </tr>
+        </table>
+           
+        <table width="100%">
              <tr>
-             	<td><input type="text" name="surname"></td>
-             	<td><input type="text" name="electronicMailAddress></td>
-             	<td><input type="text" name="city"></td>
-             	<td><input type="text" name="voice"></td>
+             	<td>Publisher:</td>
+                <td><input type="text" name="publisher" /></td>
+                <td>Title:</td>
+                <td><input type="text" name="title" /></td>
              </tr>
+             <tr>
+             	<td>Publication Date:</td>
+             	<td><input type="text" name="pubdate" /></td>
+             	<td>Alternate Title:</td>
+             	<td><input type="text" name="alttitle" /></td>
+             </tr>
+             <tr>
+             	<td>Publication Place:</td>
+             	<td><input type="text" name="pubplace" /></td>
+             	<td>URL:</td>
+             	<td><input type="text" name="url" /></td>
+             </tr>
+             <tr>
+             	<td>ISBN:</td>
+             	<td><input type="text" name="isbn" /></td>
+             	<td>Geospatial Representation Form:</td>
+             	<!-- <td><input type="text" name="geoform" /></td> -->
+             	<td>
+             	<select name="geoform">
+             	  <option value="" />
+             	  <option value="atlas" />Atlas
+             	  <option value="audio" />Audio
+             	  <option value="diagram" />Diagram
+             	  <option value="document" />Document
+             	  <option value="globe" />Globe
+             	  <option value="map" />Map
+             	  <option value="model" />Model
+             	  <option value="multimediaPresentation" />Multimedia Presentation
+             	  <option value="profile" />Profiles
+             	  <option value="rasterDigitalData" />Raster Digital Data
+             	  <option value="remoteSensingImage" />Remote Sensing Image
+             	  <option value="section" />Section
+             	  <option value="spreadsheet" />Spreadsheet
+             	  <option value="tabularDigialData" />Tabular Digial Data
+             	  <option value="vectorDigitalData" />Vector Digital Data
+             	  <option value="video" />Video
+             	  <option value="view" />View
+             	</select>
+             	</td>
+             </tr>
+             <tr>
+             	<td>ISSN:</td>
+             	<td><input type="text" name="issn" /></td>
+             	<td></td>
+             	<td></td>
+             </tr>
+             <tr>
+             	<td>Editor:</td>
+             	<td><input type="text" name="editor" /></td>
+             	<td></td>
+             	<td></td>
+             </tr>
+             <tr>
+             	<td>Edition:</td>
+             	<td><input type="text" name="edition" /></td>
+             	<td></td>
+             	<td></td>
+             </tr>
+             <tr>
+             	<td>Volume:</td>
+             	<td><input type="text" name="volume" /></td>
+             	<td></td>
+             	<td></td>
+             </tr>
+        </table>
+
+        <table width="100%" border="1">
+          <tr>
+             <td valign="bottom">
+        	<img src="http://alpha.nceas.ucsb.edu/xmltodb/lib/marine/step3.png" />
+        	<p>Enter any keywords that might partain to the dataset you are looking 
+        	   for.  The "Any Field" text box will search any field in any document
+        	   for the text you provide.
+        	   Field(s) left blank will not be used in the search criteria.  
+        	</p>
+             </td>
+          </tr>
+        </table>
            
+        <table width="100%">
+             <tr>
+             	<td>Keywords:</td>
+                <td><input type="text" name="keyword" /></td>
+                <td>Any Field:</td>
+                <td><input type="text" name="anyfield" /></td>
+             </tr>
+        </table>
+           
+        <table width="100%" border="1">
+          <tr>
+             <td valign="bottom">
+        	<img src="http://alpha.nceas.ucsb.edu/xmltodb/lib/marine/step4.png" />
+        	<p>Click the Query button to submit your query.  The results will be
+        	   displayed below under the heading "Query Results".
+        	</p>
+             </td>
+          </tr>
+        </table>
+        <input type="hidden" name="action" value="squery" />   
+    	<input type="hidden" name="query" value="" />
+    	<input type="hidden" name="qformat" value="html" />
+    	<input type="hidden" name="operator" value="UNION" />
+        
+        <input type="submit" value="Query" /><input type="reset" value="Clear Form" />
+        
         </form>
-      
+             
+        <a name="browse" />
+	
 	<center>
-          <u><h2>Query Results</h2></u>
+          <u><h2>Results</h2></u>
         </center>
         
         <form action="/servlets/marineServlet" method="POST">
         <input type="hidden" name="action" value="getdocument"/>
 
-        <xsl:text>Output Format: </xsl:text>
-        <select name="qformat">
-          <option value="html">HTML</option>
-          <option value="xml">XML</option>
-        </select>
-
         <table width="100%">
         <tr class="rowodd">
         <th>&nbsp;</th>
         <th><xsl:text>Title</xsl:text></th>
         <th><xsl:text>Resource Name</xsl:text></th>
-<!--        <th><xsl:text>Document Type</xsl:text></th> -->
         </tr>
 
         <xsl:for-each select="resultset/document">
@@ -86,14 +224,6 @@
             </xsl:attribute>
 
           <td>
-<!--
-              <input type="radio" name="docid">
-                <xsl:attribute name="value">
-                  <xsl:value-of select="./docid"/>
-                </xsl:attribute>
-              </input>
-              <input type="submit" value="Display"/>
--->
               <input border="0" type="image">
                 <xsl:attribute name="src">
                   <xsl:choose>
@@ -114,19 +244,14 @@
           <td>
               <xsl:value-of select="./docname"/> 
               <xsl:text> </xsl:text>
-<!--              <xsl:value-of select="./docid"/>
-              <xsl:text>&nbsp;</xsl:text>
--->
           </td>
-<!--          <td><xsl:value-of select="./doctype"/>
-              <xsl:text>&nbsp;</xsl:text>
-         </td> 
--->
           </tr>
         </xsl:for-each>
         </table>
         </form>
 
+        <h3><a href="#top">New Query</a></h3>
+        
       </body>
     </html>
   </xsl:template>
Index: lib/marine/marineResultset.dtd
===================================================================
--- lib/marine/marineResultset.dtd	(nonexistent)
+++ lib/marine/marineResultset.dtd	(revision 304)
@@ -0,0 +1,11 @@
+<!--         
+      '$RCSfile$'
+      Purpose: This dtd defines the resultset for the marineServlet.
+    Copyright: 2000 Regents of the University of California and the
+               National Center for Ecological Analysis and Synthesis
+      Authors: Chad Berkley
+
+     '$Author$'
+       '$Date$'
+   '$Revision$'
+-->
\ No newline at end of file

Property changes on: lib/marine/marineResultset.dtd
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: lib/marine/mms.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/marine/mms.gif
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/marine/step2.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/marine/step2.png
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/marine/step3.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/marine/step3.png
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/marine/step4.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/marine/step4.png
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/marine/marine.properties
===================================================================
--- lib/marine/marine.properties	(revision 303)
+++ lib/marine/marine.properties	(revision 304)
@@ -1,14 +1,14 @@
 #
-# Properties file defining options for the MetaCatServlet.java servlet
-# Matt Jones, Dan Higgins
+# Properties file defining options for the marineServlet.java servlet
+# Matt Jones, Dan Higgins, Chad Berkley
 # '$Id$'
 #
 user=jones
 password=kinkaj0u
-defaultDB=jdbc:oracle:thin:@24.237.20.124:1521:test
+defaultDB=jdbc:oracle:thin:@24.237.21.98:1521:test
 dbDriver=oracle.jdbc.driver.OracleDriver
-resultStyleURL=file:///home/httpd/html/marine/marine.xsl
-xmlcatalogfile=/home/httpd/html/xmltodb/lib/catalog.txt
+resultStyleURL=http://alpha.nceas.ucsb.edu/xmltodb/lib/marine/marine.xsl
+xmlcatalogfile=http://alpha.nceas.ucsb.edu/xmltodb/lib/catalog.txt
 defaultdatapath=C:\Temp\
 executescript=test.bat
 defaultGlobalName=NCEAS
Index: lib/marine/index.html
===================================================================
--- lib/marine/index.html	(revision 303)
+++ lib/marine/index.html	(revision 304)
@@ -1,21 +1,52 @@
-<!-- MARINE UI Test main page
-     Author: Chad Berkley
-     Date: 6/26/00
-     Comments: Test User Interface for MARINE Scientists
--->
-     
 <html>
-  <head>
-  <title>MetaCat MARINE Interface</title>
-  </head>
-  <frameset cols="*" frameborder=1 border=1>
-
-    <frameset rows="400,*"  frameborder=1 border=1>
-    
-    <frame src="marinetest.html" border=1 border="top">
-
-    <frame src="http://alpha.nceas.ucsb.edu/servlets/marineServlet?action=query&query=NCEAS%25&qformat=html&doctype=-//NCEAS//eml-dataset//EN" border=1 name="bottom">
-
-    </frameset>
-  </frameset>
-</html>
+<head>
+<title>MARINE Database Query Engine: Enter...</title>
+</head>
+<body bgcolor="white">
+  <center>
+     <img src="nceas.gif">
+     <img src="nsf.gif">
+     <img src="mms.gif">
+  </center>
+  <center><h1>Welcome to the MARINE database query engine</h1></center>
+  
+  <p>
+     This page is used to query information for 
+     <a href="http://www.mms.gov/omm/pacific/enviro/mint.htm">MARINE</a> scientists from
+     the NCEAS Ecological Metadata Database.  For more information on
+     this project, please read the 
+     <a href="https://www2.nceas.ucsb.edu/admin/db/web.ppage?projid_in=2841">
+     proposal abstract</a>.
+  </p>
+  
+  <p>
+  Once you enter the query page, you will be asked to fill out a form in 4 steps.  Each
+  step contains several fields relating to a part of the dataset.  You may also browse
+  the entire database by simply clicking the browse link at the top of the query page
+  or by clicking the browse button below.
+  Clicking on the buttons next to each data line will give you more
+  information about the dataset or allow you to download the entire dataset.  Please note 
+  some fields in the query forms will not be pertinent to your dataset.  If this is the case,
+  simply leave any field blank to omit it from the searching.  
+  </p>
+       
+ <center>
+  <form action="http://alpha.nceas.ucsb.edu/servlets/marineServlet" 
+              method="POST"> 
+    <input type="hidden" name="action" value="init">   
+    <input type="hidden" name="query" value="">
+    <input type="hidden" name="doctype" value="ANY">
+    <input type="hidden" name="qformat" value="html">
+    <input type="submit" value="Query the Database">
+  </form>
+  <form action="http://alpha.nceas.ucsb.edu/servlets/marineServlet#browse" 
+              method="POST"> 
+    <input type="hidden" name="action" value="init">   
+    <input type="hidden" name="query" value="">
+    <input type="hidden" name="doctype" value="ANY">
+    <input type="hidden" name="qformat" value="html">
+    <input type="submit" value="Browse the Database">
+  </form>
+ </center
+</body>
+</html>
\ No newline at end of file
Index: lib/marine/nsf.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/marine/nsf.gif
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: lib/marine/nceas.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: lib/marine/nceas.gif
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: src/edu/ucsb/nceas/metacat/marine/marineServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/marine/marineServlet.java	(revision 303)
+++ src/edu/ucsb/nceas/metacat/marine/marineServlet.java	(revision 304)
@@ -59,17 +59,17 @@
       			queryobj = new DBQuery(conn,saxparser);
         		docreader = new DBReader(conn);
         		dbt = new DBTransform(conn);
-        		/*
-        		msg = new String(conn.toString());
+        	/*
+        		msg += new String(conn.toString());
       			msg += "\n" + saxparser;
       			msg += "\n" + queryobj;
       			msg += "\n" + docreader;
       			msg += "\n" + dbt;
-      			*/
+      		*/	
       		}
       		catch(Exception e)
       		{
-      			msg = new String("Error in init\n " 
+      			msg += new String("Error in init\n " 
       			      + e.fillInStackTrace().toString() );
       		}
 	}
@@ -98,33 +98,13 @@
     		
     		try
     		{
-    			init(out); // remove this when init() 
-    			           //actually works
+    			init(out);
 		}
     		catch(Exception e)
       		{
-      			System.err.println("Exception in handleGetOrPost: ");
+      			System.err.println("marineServlet: Exception in handleGetOrPost: ");
       			System.err.println(e.toString());
-      			System.err.println(msg);
       		}
-      		
-    		if (conn == null) 
-    		{
-      			System.err.println("Connection to database lost"+  
-      			                    "...Reopening...");
-      			try 
-      			{
-        			conn = util.openDBConnection();
-        			queryobj = new DBQuery(conn, saxparser);
-        			docreader = new DBReader(conn);
-        			dbt = new DBTransform(conn);
-      			}
-      			catch (Exception e) 
-      			{
-        			System.err.println("Error opening" +
-        			                   " database connection");
-      			}
-    		}   	
     		
     		String name = null;
     		String[] value = null;
@@ -185,7 +165,9 @@
     		
     		//Jivka's login code should go here!
     		
-    		if (action.equals("query") || action.equals("squery")) 
+    		try{
+    		if (action.equals("query") || action.equals("squery")
+    		    || action.equals("init")) 
     		{
       			handleQueryAction(out, params, response);
     		} 
@@ -194,16 +176,20 @@
       			out.println("Error: action not registered" +
       			  "Please report this error.");
     		}
-		
-		//out.print("msg:<br> ");
-		//out.println(msg);
-		//out.println("<br><br>marineServlet says: ok");
-		out.close();
+    		}
+		catch(Exception e)
+		{
+			out.print("msg:<br> ");
+			//System.err.println("\n\n\n");
+			System.err.println(e.fillInStackTrace().toString());
+			System.err.println(msg);
+			//out.println(msg);
+			out.println("<br><br>marineServlet says: ok");
+			out.close();
+		}
+		System.err.println(msg);
     	}
-/** 
-   * Handle the database query request and return a result set, possibly
-   * transformed from XML into HTML
-   */
+
   	private void handleQueryAction(PrintWriter out, Hashtable params, 
                HttpServletResponse response)
         {
@@ -245,24 +231,28 @@
         		//correctly. For this reason, I have ommited the doctype
         		//here for the time being (7/20). 
         		xmlquery = new StringReader(createSQuery(params));
-        		//msg = createSQuery(params);
+        		//msg += " created sql query in squery ";
+        		msg = createSQuery(params);
       		} 
       		else if(action.equals("init"))
       		{
-      			
+      			//msg += createBrowseList();
+      			//System.err.println("in init: " + msg);
+      			xmlquery = new StringReader(createBrowseList());
       		}
       		else 
       		{
-        		msg = "Error handling query -- illegal action value";
+        		msg = "marineServlet: Error handling query -- illegal action value";
       		}
       
       		if (queryobj != null) 
       		{
       			doclist = queryobj.findDocuments(xmlquery);
+      			//msg += "\n\n" + doclist.toString();
       		} 
       		else 
       		{
-        		out.println("Query Object Init failed.");
+        		out.println("marineServlet: Query Object Init failed.");
         		return;
       		}
  
@@ -303,7 +293,7 @@
         		//out.println("Converting to HTML...");
         		XMLDocumentFragment htmldoc = null;
         		
-        		try 
+        		try  
         		{
           			XSLStylesheet style = new XSLStylesheet(
                                     new URL(resultStyleURL), null);
@@ -314,13 +304,34 @@
         		} 
         		catch (Exception e) 
         		{
-          			out.println("Error transforming document:\n" 
+          			System.err.println("Error transforming document:\n" 
           			             + e.fillInStackTrace().toString());
-          			out.println("<p>msg: " + msg + "</p>");
+
         		}
       		}
       	}
       	
+      	private String createBrowseList()
+      	{
+      		String query;
+      		query = "<?xml version=\"1.0\"?>";
+		query += "<!DOCTYPE pathquery PUBLIC \"-//NCEAS//pathquery-1.0//EN\" " + 
+          		    "\"http://alpha.nceas.ucsb.edu/dtd/misc/pathquery.dtd\" >";
+    		query += "<pathquery version=\"1.0\">";
+    		query += "<meta_file_id>unspecified</meta_file_id>";
+    		query += "<querytitle>unspecified</querytitle>";
+    		query += "<querygroup operator=\"union\">";
+    		query += "<queryterm casesensitive=\"false\" " + 
+    				         "searchmode=\"contains\">";
+    		query += "<value>";
+    		query += "%";
+    		query += "</value>";
+    		query += "</queryterm>";
+    		query += "</querygroup></pathquery>";
+    		
+    		return query;
+      	}
+      	
       	/** takes in the parameter list from the input source and 
       	    a doctype and returns a structured xml query based
       	    on the parameters.
@@ -359,7 +370,16 @@
     		{
     			query += "<returndoctype>" + doctype + "</returndoctype>";
     		}
-    		query += "<querygroup operator=\"" + ((String[])params.get("operator"))[0] + "\">";
+    		query += "<querygroup operator=\"" + 
+    		         ((String[])params.get("operator"))[0] + "\">";
+    		if(params.containsKey("anyfield") && 
+    		   !((String[])params.get("anyfield"))[0].equals(""))
+    		{
+    			query += "<queryterm casesensitive=\"false\" " +
+    			         "searchmode=\"contains\"><value>" +
+    			         ((String[])params.get("anyfield"))[0] +
+    			         "</value></queryterm>";
+    		}
     		
     		elements = params.elements();
     		keys = params.keys();
@@ -373,6 +393,8 @@
     			if(!nextkey.toString().equals("doctype") && 
     			   !nextkey.toString().equals("action")  &&
     			   !nextkey.toString().equals("qformat") && 
+    			   !nextkey.toString().equals("anyfield") &&
+    			   !nextkey.toString().equals("operator") &&
     			   !(((String[])nextelement)[0].equals("")) )
     			{
     				query += "<queryterm casesensitive=\"false\" " + 
@@ -394,7 +416,7 @@
         } 
         
         /**same as createSQuery(Hashtable, String) except
-           no doctyp is required.
+           no doctype is required.
         **/
         private String createSQuery(Hashtable params)
         {
Index: src/edu/ucsb/nceas/metacat/marine/marineUtil.java
===================================================================
--- src/edu/ucsb/nceas/metacat/marine/marineUtil.java	(revision 303)
+++ src/edu/ucsb/nceas/metacat/marine/marineUtil.java	(revision 304)
@@ -26,7 +26,7 @@
 public class marineUtil {
 
   private PropertyResourceBundle options = null;
-  private static String propertiesFile = "marine";
+  private static String propertiesFile = "edu.ucsb.nceas.metacat.marine.marine";
   private static boolean debug = false;
 
   /**
