<< Back - Alkacon logo

OpenCms 6.0 interactive documentation:

Show source

OpenCms logo - Forward >>

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


<%@ page import="com.opencms.core.*,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, unless otherwise noted.
 
  Copyright (C) 2003-2004 Alkacon Software (http://www.alkacon.com)
 
  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.
  
  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, please see the
  companys website: http://www.alkacon.com.
  
  For further information about OpenCms, please see the OpenCms project
  website: http://www.opencms.org.
  
  The names "Alkacon", "Alkacon Software" and "OpenCms" must not be used 
  to endorse or promote products derived from this software without prior 
  written permission. For written permission, please contact info@alkacon.com.
  
  Products derived from this software may not be called "Alkacon", 
  "Alkacon Software" or "OpenCms", nor may "Alkacon", "Alkacon Software" 
  or "OpenCms" appear in their name, without prior written permission of 
  Alkacon Software. 
 
  This program is also available under a commercial non-GPL license. For
  pricing and ordering information, please inquire at sales@alkacon.com.
 
--%><%    

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

    // get the template 
    String template = cms.property("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 = cms.link("/system/modules/com.alkacon.documentation/resources/ic_folder.gif");
    String fileicon = cms.link("/system/modules/com.alkacon.documentation/resources/ic_file.gif");
    String codeicon = cms.link("/system/modules/com.alkacon.documentation/resources/code.gif");
    String executeicon = cms.link("/system/modules/com.alkacon.documentation/resources/execute.gif");
    
    boolean examplefolder = "true".equals(cms.property("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)i.next();
        String description = ne.getDescription();

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

        if (! ne.getResourceName().equals(filename)) {  
            out.println("<p><b><a href=\"" + cms.link(ne.getResourceName()) + "\" 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=\"" + cms.link(ne.getResourceName()) + "\">" + 
                        "<img border=\"0\" alt=\"Show Source\" src=\"" + codeicon + "\"></a>");     
                } else {
                    out.println("&nbsp; &nbsp; <a href=\"" + cms.link(foldername + "showsource.jsp") + 
                        "?filename=" + ne.getResourceName() + "\">" + 
                        "<img border=\"0\" alt=\"Show Source\" src=\"" + codeicon +
                        "\"></a> &nbsp; &nbsp;");
                    out.println("<a href=\"" + cms.link(ne.getResourceName()) + "\">" + 
                        "<img border=\"0\" alt=\"Execute\" src=\"" + executeicon + "\"></a>");                   
                }
            }

            out.println("</p>");
            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");
%>

©2003-2005 Alkacon Software (http://www.alkacon.com) - The OpenCms experts