[opencms-dev] directory listing
Wagner,Aaron
anwagner at deq.virginia.gov
Thu Apr 3 19:32:26 CEST 2008
No, that's exactly what I wanted. Just tweeking it a bit, thanks!!
Aaron N Wagner
Web Developer, Office of Public Affairs
DEQ - Virginia Department of Environmental Quality
There are 10 types of people in the world: those who understand binary,
and those who don't.
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-
> bounces at opencms.org] On Behalf Of Isaac R. Higgins
> Sent: Thursday, April 03, 2008 1:18 PM
> To: The OpenCms mailing list
> Subject: RE: [opencms-dev] directory listing
>
> also, u can change the filter type, I have mine set to exclude JSP
>
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org on behalf of Isaac R. Higgins
> Sent: Thu 4/3/2008 11:46 AM
> To: The OpenCms mailing list
> Subject: RE: [opencms-dev] directory listing
>
> set your path on line 12:
>
>
> <%@ page session="false" %>
> <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
>
> <jsp:useBean id="cmsbean" class="org.opencms.jsp.CmsJspBean">
> <% cmsbean.init(pageContext, request, response); %>
> </jsp:useBean>
>
> <%
> org.opencms.file.CmsObject cms = cmsbean.getCmsObject();
> org.opencms.file.CmsResourceFilter filter =
> org.opencms.file.CmsResourceFilter.DEFAULT;
> filter = filter.addExcludeType(new
> org.opencms.file.types.CmsResourceTypeJsp().getStaticTypeId() );
> java.util.List al =
> cms.getResourcesInFolder("/construction_docs/Kiser/", filter);
> %>
>
> <cms:include property="template" element="head" />
> <br />
> <h2>The following are files in this folder:</h2>
> <blockquote>
> <%
> for (int i=0;i<al.size();++i){
> org.opencms.file.CmsResource ress = null;
> String description = "";
> try{
> ress =
>
cms.readResource(cms.getSitePath((org.opencms.file.CmsResource)al.get(i)
))
> ;
> description =
> cms.readPropertyObject(ress,"Title",false).getValue();
> }catch(Exception e){out.print(e);}
> %>
> <%= i+1%>. <a href="<%= (new
> org.opencms.jsp.CmsJspActionElement(pageContext, request,
>
response)).link(cms.getSitePath((org.opencms.file.CmsResource)al.get(i))
)
> %>"><%=description%></a>
> <br>
> <%}%>
> </blockquote>
>
> <cms:include property="template" element="foot" />
>
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org on behalf of Wagner,Aaron
> Sent: Thu 4/3/2008 11:04 AM
> To: The OpenCms mailing list
> Subject: [opencms-dev] directory listing
>
>
>
> I have a directory listing script like this, but now I need to expand
it
> to show all kinds of files, IE binary(pdf, doc, etc). It appears that
> the getNavigationForFolder(); only shows xmlpage file types.
>
>
>
> I don't have access to change the directory listing settings in
web.xml
> of the Tomcat server. Does anyone have any ideas to show all files in
a
> directory?
>
>
>
> ------------------------------
>
> <%@ page import="java.util.*,
>
> org.opencms.jsp.*" %><%
>
>
>
> // Create a JSP action element
>
> CmsJspActionElement cms = new CmsJspActionElement(pageContext,
request,
> response);
>
>
>
> // Get a simple navigation of all pages / subfolders in the current
> folder
>
> String uri = cms.getRequestContext().getUri();
>
> String uri2 = uri.substring(0, uri.lastIndexOf("/"));
>
>
>
> List list = cms.getNavigation().getNavigationForFolder();
>
> Iterator i = list.iterator();
>
> int navnumb = list.size();
>
>
>
> out.println("<h3>Directory listing for " + uri2 + " | Number of files:
"
> + navnumb +"</h3><ul>");
>
> while (i.hasNext()) {
>
> CmsJspNavElement ne = (CmsJspNavElement)i.next();
>
> out.println("<li><a href=\"" + cms.link(ne.getFileName()) + "\">");
>
> out.println(ne.getTitle() + "</a></li>");
>
> }
>
> out.println("</ul>");
>
> %>
>
> ------------------------------
>
>
>
> Opencms 6,2,3
>
> Tomcat 5
>
> Ocacle 10
>
>
>
>
>
> Aaron N Wagner
>
> Web Developer, Office of Public Affairs
>
> DEQ - Virginia Department of Environmental Quality
>
>
>
>
> There are 10 types of people in the world: those who understand
binary,
> and those who don't.
>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Wagner,Aaron.vcf
Type: text/x-vcard
Size: 367 bytes
Desc: Wagner,Aaron.vcf
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20080403/d73333e9/attachment.vcf>
More information about the opencms-dev
mailing list