Index: lib/metacat.properties.metadata
===================================================================
--- lib/metacat.properties.metadata	(nonexistent)
+++ lib/metacat.properties.metadata	(revision 3099)
@@ -0,0 +1,4 @@
+# user,Database Username,Database,1,Name of database user to own all tables
+# password,Database Password,Database,2,Password for database user
+# administrators,Administrators,Access Configuration,1,List of administrators for this installation in LDAP DN syntax (colon separated)
+# moderators,Moderators,Access Configuration,2,List of moderators for this installation in LDAP DN syntax (colon separated)

Property changes on: lib/metacat.properties.metadata
___________________________________________________________________
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/configure.jsp
===================================================================
--- lib/configure.jsp	(revision 3098)
+++ lib/configure.jsp	(revision 3099)
@@ -1,4 +1,4 @@
-<%@ page    language="java" import="java.util.Enumeration" %>
+<%@ page    language="java" import="java.util.Enumeration,java.util.Iterator,java.util.Set,java.util.Map,edu.ucsb.nceas.utilities.OptionsMetadata" %>
 <% 
 /**
  *  '$RCSfile$'
@@ -77,31 +77,41 @@
 <br clear="right"/>
 
 <form method="POST" action="<%= request.getContextPath() %>/metacat">
-
-<p class="section">All properties (unsorted, need to fix)</p>
-
 <% 
-   Enumeration optionsList = (Enumeration)request.getAttribute("optionslist");
-   while (optionsList.hasMoreElements()) {
-       String name = (String)optionsList.nextElement();
-       if (!name.equals("configured")) {
+    OptionsMetadata metadata = (OptionsMetadata)request.getAttribute("metadata");
+	if (metadata != null) {
+        Set groups = metadata.getGroups();
+        Iterator iter = groups.iterator();
+   		while (iter.hasNext()) {
+       		String groupName = (String)iter.next();
 %>
-        <label for="<%= name %>"><%= name %></label>
-	    <input id="<%= name %>" name="<%= name %>" 
-	           value="<%= request.getAttribute(name) %>"
-	           <% if (name.equals("password")) { %>
-	           type="password"
-	           <% } else { %>
-	           type="text" 
-	           <% } %>
-	           /><br/>
+			<p class="section"><%= groupName  %></p>
 <%
-       }
-   }
+			Map keys = metadata.getKeysInGroup(groupName);
+			Iterator optionsList = keys.values().iterator();
+			while (optionsList.hasNext()) {
+    			String name = (String)optionsList.next();
+    			if (!name.equals("configured")) {
 %>
+     				<label for="<%= name %>" title="<%= metadata.getOptionDescription(name) %>"><%= metadata.getOptionLabel(name) %></label>
+	    			<input id="<%= name %>" name="<%= name %>" 
+	           			value="<%= request.getAttribute(name) %>"
+	           			<% if (name.equals("password")) { %>
+	           				type="password"
+	           			<% } else { %>
+	           				type="text" 
+	           			<% } %>
+	           			alt="<%= metadata.getOptionDescription(name) %>"
+	           			/><br/>
+<%
+    			}
+			}
+   		}
+   	}
+%>
 
-<input type="hidden" name="action" value="configure"/>
-<p><input type="submit" value="Save"/></p>
+			<input type="hidden" name="action" value="configure"/>
+			<p><input type="submit" value="Save"/></p>
 
 </form>
 
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 3098)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 3099)
@@ -1,7 +1,7 @@
 /**
  *  '$RCSfile$'
  *    Purpose: A Class that implements a metadata catalog as a java Servlet
- *  Copyright: 2000 Regents of the University of California and the
+ *  Copyright: 2006 Regents of the University of California and the
  *             National Center for Ecological Analysis and Synthesis
  *    Authors: Matt Jones, Dan Higgins, Jivka Bojilova, Chad Berkley, Matthew Perry
  *
@@ -29,8 +29,11 @@
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.io.Reader;
 import java.io.StringReader;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -45,6 +48,7 @@
 import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Properties;
+import java.util.Set;
 import java.util.Timer;
 import java.util.Vector;
 import java.util.zip.ZipEntry;
@@ -69,6 +73,7 @@
 import com.oreilly.servlet.multipart.Part;
 
 import edu.ucsb.nceas.utilities.Options;
+import edu.ucsb.nceas.utilities.OptionsMetadata;
 import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
 import edu.ucsb.nceas.metacat.spatial.SpatialQuery;
 
@@ -149,7 +154,7 @@
             // Initialize the properties file for our options
             String dirPath = context.getRealPath(CONFIG_DIR);
             File propertyFile = new File(dirPath, CONFIG_NAME);
-
+            
             String LOG_CONFIG_NAME = dirPath + "/log4j.properties";
             PropertyConfigurator.configureAndWatch(LOG_CONFIG_NAME);
             
@@ -3243,13 +3248,26 @@
             // The servlet configuration parameters have not been set, so
             // redirect to a web form for configuring metacat
             
-            // Add attributes to the request for all configuration options so
-            // that the configuration form can display the names and values of
-            // all configuration options.
-            // TODO: Still need to determine a way to get some metadata about 
-            // each attribute to the form jsp, such as a description and 
-            // possibly a label and widget type to use and possibly a 
-            // controlled values list
+            // Load the properties metadata file to determine which properties
+            // need to be configured, and include this metadata object in
+            // the request so that the JSP page can use the metadata in 
+            // constructing the editing form
+            String dirPath = this.getServletContext().getRealPath(CONFIG_DIR);
+            File metadataFile = new File(dirPath, CONFIG_NAME+".metadata");
+            OptionsMetadata metadata = null;
+            
+            try {
+                Reader reader = new FileReader(metadataFile);
+                metadata = new OptionsMetadata(reader);
+                reader.close();
+                request.setAttribute("metadata", metadata);
+            } catch (IOException e) {
+                Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
+                logMetacat.error("Error reading properties metadata: " +
+                        e.getMessage());
+            }
+            
+            // Also add the list of options and their values to the request
             Enumeration properties = options.propertyNames();
             while (properties.hasMoreElements()) {
                 String name = (String)properties.nextElement();
@@ -3258,13 +3276,13 @@
             properties = options.propertyNames();
             request.setAttribute("optionslist", properties);
             
-            // Forward the request
+            // Forward the request to the JSP page
             forwardRequest(request, response, 
                     MetaCatUtil.getOption("configurationPage"));
         } else {
             // The configuration form is being submitted and needs to be
             // processed, setting the properties in the configuration file
-            // then restarting metacat
+            // then restart metacat
             
             // TODO: Should first validate that the options provided are 
             // legitimate, and possibly even test them (for example, use
@@ -3325,6 +3343,7 @@
             try {
                 PrintWriter out = response.getWriter();
                 out.println("Error while forwarding to: " + destination);
+                e1.printStackTrace(out);
                 out.close();
             } catch (IOException e) {
                 Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
Index: build.xml
===================================================================
--- build.xml	(revision 3098)
+++ build.xml	(revision 3099)
@@ -1026,6 +1026,8 @@
              tofile="${build.war}/web.xml" />
        <copy file="lib/metacat.properties" todir="${war.webinf}"
              filtering="yes" />
+   	   <copy file="lib/metacat.properties.metadata" todir="${war.webinf}"
+   	             filtering="no" />
        <copy todir="${war.webinf}" filtering="yes">
 	   	  <fileset dir="lib">
            <include name="skin.configs/**"/>
@@ -1045,6 +1047,7 @@
          <fileset dir="lib">
            <exclude name="*.jar"/>
            <exclude name="*.properties"/>
+         	<exclude name="*.metadata"/>
            <exclude name="web.xml"/>
            <exclude name="**/*.jpg"/>
            <exclude name="**/*.png"/>
