package com.opencms.workplace;

/*
 * File   : $File$
 * Date   : $Date: 2001/01/12 15:09:24 $
 * Version: $Revision: 1.2 $
 *
 * Copyright (C) 2000  The OpenCms Group 
 * 
 * This File is part of OpenCms -
 * the Open Source Content Mananagement System
 *
 * This program 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; either version 2
 * of the License, or (at your option) any later version.
 * 
 * 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.
 * 
 * For further information about OpenCms, please see the
 * OpenCms Website: http://www.opencms.com
 * 
 * You should have received a copy of the GNU General Public License
 * long with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

import com.opencms.file.*;
import com.opencms.core.*;
import com.opencms.util.*;
import com.opencms.template.*;

import java.util.*;

import javax.servlet.http.*;

/**
 * Template class for displaying OpenCms workplace administration module
 *
 * Creation date: (30.08.00 17:59:38)
 * @author: Hanjo Riege
 */
public class CmsModuleDemos extends CmsWorkplaceDefault implements I_CmsConstants {
	/**
	 * Gets the content of a defined section in a given template file and its subtemplates
	 * with the given parameters. 
	 * 
	 * @see getContent(CmsObject cms, String templateFile, String elementName, Hashtable parameters)
	 * @param cms CmsObject Object for accessing system resources.
	 * @param templateFile Filename of the template file.
	 * @param elementName Element name of this template in our parent template.
	 * @param parameters Hashtable with all template class parameters.
	 * @param templateSelector template section that should be processed.
	 */
	public byte[] getContent(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) throws CmsException {
		if(C_DEBUG && A_OpenCms.isLogging()) {
			A_OpenCms.log(C_OPENCMS_DEBUG, this.getClassName() + "getting content of element " + ((elementName==null)?"<root>":elementName));
			A_OpenCms.log(C_OPENCMS_DEBUG, this.getClassName() + "template file is: " + templateFile);
			A_OpenCms.log(C_OPENCMS_DEBUG, this.getClassName() + "selected template section is: " + ((templateSelector==null)?"<default>":templateSelector));
		}
		
		CmsXmlTemplateFile templateDocument = getOwnTemplateFile(cms, templateFile, elementName, parameters, templateSelector);
		I_CmsRegistry reg = cms.getRegistry();
		Vector tester = new Vector();
		String currentname;
		
		Enumeration modules = reg.getModuleNames();
		String completeList = "";
		String servPath = ((HttpServletRequest)cms.getRequestContext().getRequest().getOriginalRequest()).getServletPath();
		while (modules.hasMoreElements()) {
			String name = (String) modules.nextElement();
			String nicename = reg.getModuleNiceName(name);
			if (nicename == null || nicename.equals(""))
				currentname = name;
			else
				currentname = nicename;		
			templateDocument.setData("name", currentname);
			templateDocument.setData("namelink", servPath + "/moduledemos/" + name + "/index.html");
			completeList += templateDocument.getProcessedDataValue("list_entry");
			templateDocument.setData("doc_name", currentname);
			templateDocument.setData("doc_link", servPath + "/system/modules/" + name + "/doc/doc.html");	
			completeList += templateDocument.getProcessedDataValue("doc_entry");
			}
			templateDocument.setData("list", completeList);
		

		// Now load the template file and start the processing
		return startProcessing(cms, templateDocument, elementName, parameters, templateSelector);
	}
	/**
	 * Indicates if the results of this class are cacheable.
	 * 
	 * @param cms CmsObject Object for accessing system resources
	 * @param templateFile Filename of the template file 
	 * @param elementName Element name of this template in our parent template.
	 * @param parameters Hashtable with all template class parameters.
	 * @param templateSelector template section that should be processed.
	 * @return <EM>true</EM> if cacheable, <EM>false</EM> otherwise.
	 */
	public boolean isCacheable(CmsObject cms, String templateFile, String elementName, Hashtable parameters, String templateSelector) {
		return false;
	}
}

@@ -79,18 +79,18 @@
 01/1
-2 15:09:24
+9 09:28:47
  $%0A 
@@ -113,17 +113,17 @@
 sion: 1.
-2
+3
  $%0A *%0A *
@@ -3625,19 +3625,21 @@
 + %22/doc/
-doc
+index
 .html%22);

Change doc.html in folder doc/ in index.html.