Source code for: /system/modules/com.alkacon.documentation/elements/index.html

<%@ page import="org.opencms.main.*,java.util.*,org.opencms.jsp.*" %><%--

  This program is part of the Alkacon OpenCms Software library.
  This license applies to all programs, pages, Java classes, parts and
  modules of the Alkacon OpenCms Software library published by
  Alkacon Software GmbH, unless otherwise noted.
  Copyright (c) Alkacon Software GmbH (
  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
  General Public License for more details.
  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  For further information about Alkacon Software GmbH, please see the
  companys website:
  For further information about OpenCms, please see the OpenCms project
  The names "Alkacon", "Alkacon Software GmbH" and "OpenCms" must not be used 
  to endorse or promote products derived from this software without prior 
  written permission. For written permission, please contact
  Products derived from this software may not be called "Alkacon", 
  "Alkacon Software GmbH" or "OpenCms", nor may "Alkacon", "Alkacon Software GmbH" 
  or "OpenCms" appear in their name, without prior written permission of 
  Alkacon Software GmbH. 
  This program is also available under a commercial non-GPL license. For
  pricing and ordering information, please inquire at

    // Create a JSP action element
    org.opencms.jsp.CmsJspActionElement cms = new CmsJspActionElement(pageContext, request, response);

    // get the template 
    String template ="template", "search", "system/modules/com.alkacon.documentation/templates/alkacon-documentation");

    // load template head
    cms.include(template, "head");       
    // Get the current file and folder name
    String filename = cms.getCmsObject().getRequestContext().getUri();
    String foldername = org.opencms.file.CmsResource.getFolderPath(filename);
    String foldericon ="/system/modules/com.alkacon.documentation/resources/images/ic_folder.gif");
    String fileicon ="/system/modules/com.alkacon.documentation/resources/images/ic_file.gif");
    String codeicon ="/system/modules/com.alkacon.documentation/resources/images/code.gif");
    String executeicon ="/system/modules/com.alkacon.documentation/resources/images/execute.gif");
    boolean examplefolder = "true".equals("examplefolder", "search", "false"));    
    // look for index_content.html file in current folder
    try {
        cms.include(foldername + "index_content.html", "body", true);
    } catch (Exception e) {
        // file does not exist, ignore and go on
    // Get a list of all pages / subfolders in the folder (sorted by NavPos property)
    List list = cms.getNavigation().getNavigationForFolder();
    Iterator i = list.iterator();

    while (i.hasNext()) {
        CmsJspNavElement ne = (CmsJspNavElement);
        String description = ne.getDescription();

    	String target = ne.getProperty("target");
	    if (! "external".equals(target)) target = "_self";

        if (! ne.getResourceName().equals(filename)) {  
            out.println("<p class=\"listlink\"><b><a href=\"" + + "\" target=\"" + target + "\" >");
            if (ne.isFolderLink()) {
                out.println("<img src=\"" + foldericon + "\" border=\"0\" alt=\"folder\"> ");
            } else {
                out.println("<img src=\"" + fileicon + "\" border=\"0\" alt=\"file\"> ");
            out.println(ne.getTitle() + "</a></b>");
            if (examplefolder && ! ne.isFolderLink()) {
                if (ne.getFileName().startsWith("link_")) {
                    out.println("&nbsp; &nbsp; <a href=\"" + + "\">" + 
                        "<img border=\"0\" alt=\"Show Source\" src=\"" + codeicon + "\"></a>");     
                } else {
                    out.println("&nbsp; &nbsp; <a href=\"" + + "showsource.jsp") + 
                        "?filename=" + ne.getResourceName() + "\">" + 
                        "<img border=\"0\" alt=\"Show Source\" src=\"" + codeicon +
                        "\"></a> &nbsp; &nbsp;");
                    out.println("<a href=\"" + + "\">" + 
                        "<img border=\"0\" alt=\"Execute\" src=\"" + executeicon + "\"></a>");                   

            if (description==null) {
                description = "Click on the link above to open this item.";
            out.println("<p class=\"list\">" + description + "</p>");
    // load template foot
    cms.include(template, "foot");