Index: /trunk/gsdl/src/recpt/browsetools.cpp
===================================================================
--- /trunk/gsdl/src/recpt/browsetools.cpp	(revision 2804)
+++ /trunk/gsdl/src/recpt/browsetools.cpp	(revision 2805)
@@ -534,6 +534,208 @@
 				textout, logout);
   }
-  
   delete formatlistptr;
+}
+
+/**
+ * This function outputs contents of a classifier to the reader
+ * including parent levels
+ */
+void expand_show_contents (cgiargsclass &args, int tabcount, bool fulltoc,
+			browsermapclass *browsermap, formatinfo_t &formatinfo,
+			recptproto *collectproto, displayclass &disp,
+			outconvertclass &outconvert, ostream &textout, 
+			ostream &logout)
+{
+
+	int coloffset = 0;
+	text_tarray parents;
+	FilterResponse_t response;
+ 	text_t OID = args["d"];
+	if (OID.empty()) OID = args["cl"];
+
+	bool haschildren = has_children (OID, args["c"], collectproto, logout);
+
+	// get parents list
+	if (!is_top(OID)) get_parents_array (OID, parents);
+	if (args["d"].empty() || haschildren || parents.empty())
+		parents.push_back(OID);
+
+	// if inside a book top title is needed
+	if (!args["d"].empty()) {
+		
+		coloffset = 1;
+		text_t classification, classifytype, formatstring, topOID = parents[0];
+		text_tset metadata;
+		format_t *formatlistptr = new format_t();
+		bool use_table, getParents = false;
+		
+		get_top (args["cl"], classification);
+
+		// getting information about top OID
+		metadata.insert ("thistype");
+
+		get_info ( topOID, args["c"], metadata, getParents, collectproto, response, logout);
+		if (!response.docInfo[0].metadata["thistype"].values.empty()) 
+			classifytype = response.docInfo[0].metadata["thistype"].values[0];
+
+		browserclass *bptr = browsermap->getbrowser (classifytype);
+
+		if (classifytype.empty()) {
+			bptr = browsermap->get_default_browser();
+		}
+
+		// get the formatstring if there is one or use the browsers default
+		if (!get_formatstring (classification, classifytype, 
+			formatinfo.formatstrings, formatstring))
+				formatstring = bptr->get_default_formatstring();
+
+		parse_formatstring (formatstring, formatlistptr, metadata, getParents);
+
+		metadata.insert ("doctype");
+		metadata.insert ("haschildren");
+
+		get_info (topOID, args["c"], metadata, getParents, collectproto, response, logout);
+
+		// ouput top OID section
+		use_table = is_table_content (formatlistptr);
+		bptr->output_section_group (response.docInfo[0], args, "", tabcount, formatlistptr, use_table,
+				metadata, getParents, collectproto, disp, outconvert, textout, logout);
+
+	}
+
+	recurse_contents_levels (parents, args, coloffset, tabcount, fulltoc, browsermap, 
+		formatinfo, collectproto, disp, outconvert, textout, logout);
+
+	textout << "</table></td></tr></table>\n";
+}
+
+void recurse_contents_levels (text_tarray &parents, 
+			cgiargsclass &args, int coloffset, int tabcount, bool fulltoc,
+			browsermapclass *browsermap, formatinfo_t &formatinfo,
+			recptproto *collectproto, displayclass &disp,
+			outconvertclass &outconvert, ostream &textout, 
+			ostream &logout)
+{
+	FilterResponse_t response;
+	text_tset metadata;
+	text_t OID, formatstring, classification, classifytype;;
+	bool use_table, getParents = false;
+	int haschildren = 0;
+	format_t *formatlistptr = new format_t();
+
+	// display children for last level
+	if (tabcount == (parents.size() - 1)) {
+
+		logout << "@@@lastlevel@@@\n";
+		// setting metadata fields 
+		metadata.insert ("thistype");
+		metadata.insert ("childtype");
+		metadata.insert ("haschildren");
+
+		OID = parents[tabcount];
+		get_info (OID, args["c"], metadata, getParents, collectproto, response, logout);
+		get_top (OID, classification);
+
+		if (!response.docInfo.empty())
+			haschildren = response.docInfo[0].metadata["haschildren"].values[0].getint();
+
+		// get childrens classifytype
+		if (!response.docInfo.empty())
+			classifytype = response.docInfo[0].metadata["childtype"].values[0];
+		else {
+			// use the default
+			browserclass *bptr = browsermap->get_default_browser ();
+			classifytype = bptr->get_browser_name ();
+		}
+
+		// load up metadata array with browser defaults
+		browserclass *bptr = browsermap->getbrowser (classifytype);
+		bptr->load_metadata_defaults (metadata);
+
+		// get the formatstring if there is one or use the browsers default
+		if (!get_formatstring (classification, classifytype, 
+			formatinfo.formatstrings, formatstring))
+				formatstring = bptr->get_default_formatstring();
+
+		parse_formatstring (formatstring, formatlistptr, metadata, getParents);
+
+		if (haschildren) 
+			get_children (OID, args["c"], metadata, getParents,
+				collectproto, response, logout);
+		else if (!is_top(OID)) {
+			get_children (OID + ".pr", args["c"], metadata, getParents, 
+			collectproto, response, logout);
+			haschildren = true;
+		}
+
+		// display children
+		if (haschildren) {
+			use_table = is_table_content (formatlistptr);
+			bptr->output_section_group (response, args, args["c"], coloffset + tabcount, formatlistptr, use_table, 
+						metadata, getParents, collectproto, disp, outconvert, 
+						textout, logout);
+		}
+
+	} else {
+
+		text_t pOID;
+		OID = parents[tabcount];
+		get_top (OID, classification);
+
+		// load metadata fields
+		metadata.insert ("thistype");
+		metadata.insert ("childtype");
+		metadata.insert ("haschildren");
+		metadata.insert ("doctype");
+
+		if (tabcount) pOID = parents[tabcount-1];
+		else pOID = OID;
+		get_info (pOID, args["c"], metadata, getParents, collectproto, response, logout);
+
+		// get classifytype of this level
+		if (is_top (pOID)) classifytype = response.docInfo[0].metadata["childtype"].values[0];
+		else classifytype = response.docInfo[0].metadata["thistype"].values[0];
+
+		// if we still don't have a classifytype we'll use the default
+		if (classifytype.empty()) {
+			browserclass *bptr = browsermap->get_default_browser ();
+			classifytype = bptr->get_browser_name ();
+		}
+
+		browserclass *bptr = browsermap->getbrowser (classifytype);
+
+		// get the formatstring if there is one or use the browsers default
+		if (!get_formatstring (classification, classifytype, 
+				formatinfo.formatstrings, formatstring))
+			formatstring = bptr->get_default_formatstring();
+
+
+		// parse format string 
+		parse_formatstring (formatstring, formatlistptr, metadata, getParents);
+
+		use_table = is_table_content (formatlistptr);
+
+		get_children (OID, args["c"], metadata, getParents, collectproto, response, logout);
+
+		ResultDocInfo_tarray::iterator thissibling = response.docInfo.begin();
+		ResultDocInfo_tarray::iterator lastsibling = response.docInfo.end();
+
+		while (thissibling != lastsibling) {
+
+			logout << "@@@level:@@@" << tabcount << "\n";
+
+			bptr->output_section_group (*thissibling, args, args["c"], coloffset + tabcount, formatlistptr, 
+					use_table, metadata, getParents, collectproto, 
+					disp, outconvert, textout, logout);
+			
+			if ((*thissibling).OID == parents[tabcount+1]) {
+				recurse_contents_levels (parents, args, coloffset, tabcount+1, fulltoc, browsermap,
+					formatinfo, collectproto, disp, outconvert,textout, logout);
+			}
+
+			thissibling ++;
+		}
+	}
+	delete formatlistptr;
 }
 
@@ -585,5 +787,10 @@
       expanded_contents (args, tabcount, fulltoc, browsermap, formatinfo, 
 			 collectproto, disp, outconvert, textout, logout);
-    } else {
+    } else if (args.getintarg("gc") == 2) {
+
+		// expand visible levels of table of contents
+	  expand_show_contents(args, tabcount, fulltoc, browsermap, formatinfo,
+			collectproto, disp, outconvert, textout, logout);
+	} else {
       
       // contracted table of contents
@@ -604,3 +811,2 @@
 }
 
-
Index: /trunk/gsdl/src/recpt/browsetools.h
===================================================================
--- /trunk/gsdl/src/recpt/browsetools.h	(revision 2804)
+++ /trunk/gsdl/src/recpt/browsetools.h	(revision 2805)
@@ -44,4 +44,17 @@
 			ostream &logout);
 
+void expand_show_contents (cgiargsclass &args, int tabcount, bool fulltoc,
+			browsermapclass *browsermap, formatinfo_t &formatinfo, 
+			recptproto *collectproto, displayclass &disp, 
+			outconvertclass &outconvert, ostream &textout, 
+			ostream &logout);
+
+void recurse_contents_levels (text_tarray &parents, 
+			cgiargsclass &args, int coloffset, int tabcount, bool fulltoc,
+			browsermapclass *browsermap, formatinfo_t &formatinfo,
+			recptproto *collectproto, displayclass &disp,
+			outconvertclass &outconvert, ostream &textout, 
+			ostream &logout);
+
 void contracted_contents (cgiargsclass &args, int tabcount, bool fulltoc, 
 			  browsermapclass *browsermap, formatinfo_t &formatinfo, 
Index: /trunk/gsdl/src/recpt/documentaction.cpp
===================================================================
--- /trunk/gsdl/src/recpt/documentaction.cpp	(revision 2804)
+++ /trunk/gsdl/src/recpt/documentaction.cpp	(revision 2805)
@@ -165,5 +165,5 @@
   // check gc argument
   int arg_gc = args.getintarg("gc");
-  if (arg_gc != 0 && arg_gc != 1) {
+  if (arg_gc < 0 || arg_gc > 2) {
     logout << "Warning: \"gc\" argument out of range (" << arg_gc << ")\n";
     cgiarginfo *gcinfo = argsinfo.getarginfo ("gc");
