Index: /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java
===================================================================
--- /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java	(revision 32648)
+++ /main/trunk/greenstone3/src/java/org/greenstone/gsdl3/action/PageAction.java	(revision 32649)
@@ -5,4 +5,5 @@
 
 import org.apache.log4j.Logger;
+import org.greenstone.gsdl3.service.CollectionGroups;
 import org.greenstone.gsdl3.util.GSParams;
 import org.greenstone.gsdl3.util.GSPath;
@@ -24,4 +25,7 @@
 	public static final String PREFS_PAGE = "pref";
 	public static final String GLI4GS3_PAGE = "gli4gs3";
+
+  // this gets set to the groupInfo service name if there is one.
+  protected String groupInfoServiceName = null;
 
 	public Node process(Node message_node)
@@ -123,48 +127,63 @@
 			return null;
 		}
+
+		// import it into our current doc.
+		info_response = (Element) doc.importNode(info_response, true);
 		
 		Element resp_service_list = (Element) GSXML.getChildByTagName(info_response, GSXML.SERVICE_ELEM + GSXML.LIST_MODIFIER);
-		
+
+		// TODO - is this true? can we run with no MR services? can't we still query for the collections/MR info?
 		if (resp_service_list == null) {
 			logger.error("No services available. Couldn't query the message router!");
 			return null;
 		}
-		Element groupInfoService = GSXML.getNamedElement(resp_service_list, GSXML.SERVICE_ELEM, GSXML.TYPE_ATT,
-				GSXML.SERVICE_TYPE_GROUPINFO);
-		if (groupInfoService != null) {
-			// Prepare request for CollectionGroup service to get current
-			// collections and groups list
-			Element group_info_message = doc.createElement(GSXML.MESSAGE_ELEM);
-			Element group_info_request = GSXML.createBasicRequest(doc, GSXML.TO_ATT,
-					groupInfoService.getAttribute(GSXML.NAME_ATT), userContext);
-			group_info_message.appendChild(group_info_request);
-			//Append group request if exists
-			Element paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
-			if (paramList != null) {
-				group_info_request.appendChild(doc.importNode(paramList, true));
-			}
-			Element group_info_response_message = (Element) this.mr.process(group_info_message);
-			Element group_info_response = (Element) GSXML.getChildByTagName(group_info_response_message,
-					GSXML.RESPONSE_ELEM);
-			Element collection_list = (Element) GSXML.getChildByTagName(group_info_response,
-					GSXML.COLLECTION_ELEM + GSXML.LIST_MODIFIER);
-			// Add Collection List from CollectionGroup Service to response
-			// from message router
-			info_response = (Element) doc.importNode(info_response, true);
-			if (collection_list != null) {
-				info_response.appendChild(doc.importNode(collection_list, true));
-			}
-			Element group_list = (Element) GSXML.getChildByTagName(group_info_response,
-					GSXML.GROUP_ELEM + GSXML.LIST_MODIFIER);
-			if (group_list != null) {
-				info_response.appendChild(doc.importNode(group_list, true));
-			}
-			Element path_list = (Element) GSXML.getChildByTagName(group_info_response,
-					GSXML.PATH_ELEM + GSXML.LIST_MODIFIER);
-			if (path_list != null) {
-				info_response.appendChild(doc.importNode(path_list, true));
-			}
-			// Send message to groupInfoType Services
+
+		// if we haven't done so already, check for group info type service
+		if (this.groupInfoServiceName ==  null) {
+
+		  Element groupInfoService = GSXML.getNamedElement(resp_service_list, GSXML.SERVICE_ELEM, GSXML.NAME_ATT,
+								   CollectionGroups.GROUP_CONTENT);
+		  
+		  if (groupInfoService != null) {
+		    this.groupInfoServiceName = CollectionGroups.GROUP_CONTENT; 
+		  } else {
+		    this.groupInfoServiceName = "NO_GROUPS";
+		  }
+		}
+		
+		if (!this.groupInfoServiceName.equals("NO_GROUPS")) {
+
+		  String group = null;
+		  Element cgi_paramList = (Element) GSXML.getChildByTagName(request, GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
+		  HashMap<String, Serializable> params = GSXML.extractParams(cgi_paramList, false);
+		  if (params != null) {
+		    group = (String) params.get(GSParams.GROUP);
+		    if (group.equals("")) {
+		      group = null;
+		    }
+		  }
+		  
+		  Element group_info_response = getGroupInfo(group, userContext);
+
+		  // Add all the needed parts of the response to the main page response
+		  Element collection_list = (Element) GSXML.getChildByTagName(group_info_response,
+									      GSXML.COLLECTION_ELEM + GSXML.LIST_MODIFIER);
+			
+		  if (collection_list != null) {
+		    info_response.appendChild(doc.importNode(collection_list, true));
+		  }
+		  Element group_list = (Element) GSXML.getChildByTagName(group_info_response,
+									 GSXML.GROUP_ELEM + GSXML.LIST_MODIFIER);
+		  if (group_list != null) {
+		    info_response.appendChild(doc.importNode(group_list, true));
+		  }
+		  Element path_list = (Element) GSXML.getChildByTagName(group_info_response,
+									GSXML.PATH_ELEM + GSXML.LIST_MODIFIER);
+		  if (path_list != null) {
+		    info_response.appendChild(doc.importNode(path_list, true));
+		  }
+		  
 		} else {
+		  
 			// If no service with type SERVICE_TYPE_GROUPINFO could be provided
 			// request message router for all available collections
@@ -187,5 +206,4 @@
 		// elements but for now, we'll just get it all
 		Element collection_list = (Element) GSXML.getChildByTagName(info_response, GSXML.COLLECTION_ELEM + GSXML.LIST_MODIFIER);
-		//logger.debug(GSXML.xmlNodeToString(collection_list));
 		if (collection_list != null)
 		{
@@ -227,4 +245,25 @@
 	} // homePage
 
+  /** sends a request to GroupCurrentContent service to get group info. null group will give top level info,
+      otherwise will just give info for specified group */
+  protected Element getGroupInfo(String group, UserContext userContext) {
+    Document doc = XMLConverter.newDOM();
+    // collections and groups list
+    Element group_info_message = doc.createElement(GSXML.MESSAGE_ELEM);
+    Element group_info_request = GSXML.createBasicRequest(doc, GSXML.TO_ATT,
+							  groupInfoServiceName, userContext);
+    group_info_message.appendChild(group_info_request);
+    if (group != null) {
+      Element param_list = doc.createElement(GSXML.PARAM_ELEM + GSXML.LIST_MODIFIER);
+      GSXML.addParameterToList(param_list, GSParams.GROUP, group);
+      group_info_request.appendChild(param_list);
+    }
+    // send off the request
+    Element group_info_response_message = (Element) this.mr.process(group_info_message);
+    Element group_info_response = (Element) GSXML.getChildByTagName(group_info_response_message,
+								    GSXML.RESPONSE_ELEM);
+    return group_info_response;
+  }
+  
   protected Element aboutOrPrefsPage(Element request, String page_name)
 	{
@@ -302,4 +341,17 @@
 
 		Element response = (Element) GSXML.getChildByTagName(coll_about_response, GSXML.RESPONSE_ELEM);
+
+		// is this collection part of a group? 
+		String group = (String) params.get(GSParams.GROUP);
+		if (group != null && !group.equals("")) {
+		  // ...yes it is. get the group path info
+		  Element group_info_response = getGroupInfo(group, userContext); 
+		  Element path_list = (Element) GSXML.getChildByTagName(group_info_response,
+									GSXML.PATH_ELEM + GSXML.LIST_MODIFIER);
+		  if (path_list != null) {
+		    response.appendChild(response.getOwnerDocument().importNode(path_list, true));
+		  }
+		}
+		
 		//add the site metadata
 		addSiteMetadata(response, userContext);
